From f6d04fba4b42de04f8e82f2d9441660fd4ab2746 Mon Sep 17 00:00:00 2001 From: charithag Date: Tue, 29 Mar 2016 12:59:10 +0530 Subject: [PATCH] Fix module locations --- .../pom.xml | 173 --------- .../AbstractMobileOperationManager.java | 41 --- .../device/mgt/mobile/DataSourceListener.java | 25 -- .../DataSourceNotAvailableException.java | 52 --- .../MobileDeviceMgtPluginException.java | 57 --- .../mobile/common/MobilePluginConstants.java | 29 -- .../MobileDeviceConfigurationManager.java | 79 ---- .../config/MobileDeviceManagementConfig.java | 42 --- .../MobileDeviceManagementRepository.java | 57 --- .../datasource/DataSourceConfigAdapter.java | 51 --- .../datasource/JNDILookupDefinition.java | 79 ---- .../datasource/MobileDataSourceConfig.java | 51 --- .../MobileDataSourceConfigurations.java | 41 --- ...tractMobileDeviceManagementDAOFactory.java | 102 ------ .../mgt/mobile/dao/MobileDeviceDAO.java | 74 ---- .../MobileDeviceManagementDAOException.java | 80 ----- .../dao/MobileDeviceManagementDAOFactory.java | 27 -- .../mgt/mobile/dao/MobileFeatureDAO.java | 110 ------ .../mobile/dao/impl/MobileFeatureDAOImpl.java | 336 ------------------ .../util/MobileDeviceManagementDAOUtil.java | 139 -------- .../device/mgt/mobile/dto/MobileDevice.java | 125 ------- .../dto/MobileDeviceOperationMapping.java | 86 ----- .../device/mgt/mobile/dto/MobileFeature.java | 73 ---- .../mgt/mobile/dto/MobileFeatureProperty.java | 45 --- .../mgt/mobile/dto/MobileOperation.java | 64 ---- .../mobile/dto/MobileOperationProperty.java | 54 --- .../MobileDeviceManagementDataHolder.java | 67 ---- ...obileDeviceManagementServiceComponent.java | 181 ---------- ...bileDeviceManagementSchemaInitializer.java | 62 ---- .../util/MobileDeviceManagementUtil.java | 320 ----------------- .../MobileDeviceManagementConfigTests.java | 141 -------- .../mgt/mobile/impl/common/DBTypes.java | 29 -- .../impl/common/TestDBConfiguration.java | 90 ----- .../impl/common/TestDBConfigurations.java | 39 -- .../impl/dao/util/MobileDatabaseUtils.java | 111 ------ .../malformed-mobile-config-no-api-config.xml | 41 --- ...-mobile-config-no-api-publisher-config.xml | 42 --- ...malformed-mobile-config-no-apis-config.xml | 42 --- .../malformed-mobile-config-no-ds-config.xml | 42 --- ...malformed-mobile-config-no-jndi-config.xml | 42 --- .../malformed-mobile-config-no-mgt-repo.xml | 42 --- .../MobileDeviceManagementConfigSchema.xsd | 69 ---- .../src/test/resources/log4j.properties | 33 -- .../src/test/resources/sql/h2.sql | 54 --- .../src/test/resources/testdbconfig.xml | 24 -- .../src/test/resources/testng.xml | 27 -- .../pom.xml | 82 ----- .../url/printer/URLPrinterStartupHandler.java | 64 ---- .../internal/URLPrinterDataHolder.java | 42 --- ...PrinterStartupHandlerServiceComponent.java | 73 ---- .../url/printer/URLPrinterStartupHandler.java | 4 +- .../AndroidDeviceManagementService.java | 0 .../impl/android/AndroidDeviceManager.java | 0 .../impl/android/AndroidFeatureManager.java | 0 .../AndroidPolicyMonitoringService.java | 0 .../impl/android/dao/AndroidDAOFactory.java | 0 .../AndroidFeatureManagementDAOException.java | 0 .../dao/impl/AndroidDeviceDAOImpl.java | 0 .../dao/impl/AndroidFeatureDAOImpl.java | 0 .../mobile/impl/android/gcm/GCMResult.java | 0 .../mobile/impl/android/gcm/GCMService.java | 0 .../mgt/mobile/impl/android/gcm/GCMUtil.java | 0 .../android/util/AndroidPluginConstants.java | 0 .../impl/android/util/AndroidPluginUtils.java | 0 .../impl/android/util/AndroidUtils.java | 0 .../WindowsDeviceManagementService.java | 0 .../impl/windows/WindowsDeviceManager.java | 0 .../impl/windows/WindowsFeatureManager.java | 0 .../WindowsPolicyMonitoringService.java | 0 .../impl/windows/dao/WindowsDAOFactory.java | 0 .../WindowsFeatureManagementDAOException.java | 0 .../dao/impl/WindowsDeviceDAOImpl.java | 0 .../dao/impl/WindowsFeatureDAOImpl.java | 0 .../windows/util/WindowsPluginConstants.java | 0 .../impl/windows/util/WindowsPluginUtils.java | 0 .../impl/windows/util/WindowsUtils.java | 0 .../MobileDeviceManagementDataHolder.java | 19 + ...obileDeviceManagementServiceComponent.java | 44 +++ .../mobile-plugins/mobile-base-plugin/pom.xml | 4 +- components/mobile-plugins/pom.xml | 5 +- .../pom.xml | 6 +- .../src/main/resources/build.properties | 0 .../src/main/resources/conf/mobile-config.xml | 0 .../dbscripts/plugins/android/h2.sql | 0 .../dbscripts/plugins/android/mssql.sql | 0 .../dbscripts/plugins/android/mysql.sql | 0 .../dbscripts/plugins/android/oracle.sql | 0 .../dbscripts/plugins/android/postgresql.sql | 0 .../resources/dbscripts/plugins/ios/h2.sql | 0 .../resources/dbscripts/plugins/ios/mssql.sql | 0 .../resources/dbscripts/plugins/ios/mysql.sql | 0 .../dbscripts/plugins/ios/oracle.sql | 0 .../dbscripts/plugins/ios/postgresql.sql | 0 .../dbscripts/plugins/windows/h2.sql | 0 .../dbscripts/plugins/windows/mssql.sql | 0 .../dbscripts/plugins/windows/mysql.sql | 0 .../dbscripts/plugins/windows/oracle.sql | 0 .../dbscripts/plugins/windows/postgresql.sql | 0 .../src/main/resources/p2.inf | 0 .../mobile-base-plugin-feature}/pom.xml | 31 +- .../pom.xml | 5 +- pom.xml | 5 +- 102 files changed, 81 insertions(+), 3893 deletions(-) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceListener.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceNotAvailableException.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobileDeviceMgtPluginException.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobilePluginConstants.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementConfig.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementRepository.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/DataSourceConfigAdapter.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/JNDILookupDefinition.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/AbstractMobileDeviceManagementDAOFactory.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOException.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileFeatureDAO.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeatureDAOImpl.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDevice.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDeviceOperationMapping.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeature.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeatureProperty.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperation.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperationProperty.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementSchemaInitializer.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConfigTests.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/DBTypes.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfiguration.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDatabaseUtils.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-publisher-config.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-apis-config.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-ds-config.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-jndi-config.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-mgt-repo.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/schema/MobileDeviceManagementConfigSchema.xsd delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/log4j.properties delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testdbconfig.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testng.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/pom.xml delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterDataHolder.java delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterStartupHandlerServiceComponent.java rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidFeatureManagementDAOException.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMResult.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMService.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMUtil.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginUtils.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsFeatureManager.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsFeatureManagementDAOException.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginUtils.java (100%) rename components/{device-mgt/org.wso2.carbon.device.mgt.mobile.impl => mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile}/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsUtils.java (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/pom.xml (96%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/build.properties (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mssql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgresql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mssql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgresql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mssql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql (100%) rename features/{device-mgt => mobile-plugins-feature/mobile-base-plugin-feature}/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf (100%) rename {components/device-mgt => features/mobile-plugins-feature/mobile-base-plugin-feature}/pom.xml (53%) rename features/{device-mgt => mobile-plugins-feature}/pom.xml (89%) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml deleted file mode 100644 index c91d9b7df..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - device-mgt - org.wso2.carbon.devicemgt-plugins - 2.1.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.impl - 2.1.0-SNAPSHOT - bundle - WSO2 Carbon - Mobile Device Management Impl - WSO2 Carbon - Mobile Device Management Impl - http://wso2.org - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - 1.4.0 - true - - - ${project.artifactId} - ${project.artifactId} - ${carbon.mobile.device.mgt.version} - Device Management Mobile Impl Bundle - org.wso2.carbon.device.mgt.mobile.internal - - org.osgi.framework, - org.osgi.service.component, - org.apache.commons.logging, - javax.xml.bind.*, - javax.naming, - javax.sql, - javax.xml.parsers, - org.w3c.dom, - 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.registry.core, - org.wso2.carbon.registry.core.service, - org.wso2.carbon.registry.core.session, - org.wso2.carbon.registry.api, - org.wso2.carbon.device.mgt.extensions.license.mgt.registry, - com.google.gson.*, - - - !org.wso2.carbon.device.mgt.mobile.internal, - !org.wso2.carbon.device.mgt.mobile.impl, - org.wso2.carbon.device.mgt.mobile.*, - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - - file:src/test/resources/log4j.properties - - - - src/test/resources/testng.xml - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.wso2.carbon - org.wso2.carbon.core - - - org.wso2.carbon - org.wso2.carbon.logging - - - 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 - - - org.wso2.carbon - org.wso2.carbon.ndatasource.core - - - org.wso2.carbon.devicemgt - org.wso2.carbon.policy.mgt.common - - - org.wso2.carbon.devicemgt - org.wso2.carbon.policy.mgt.core - - - org.wso2.carbon - org.wso2.carbon.registry.api - - - org.wso2.carbon - org.wso2.carbon.registry.core - - - org.testng - testng - - - org.apache.tomcat.wso2 - jdbc-pool - - - com.h2database.wso2 - h2-database-engine - test - - - com.google.code.gson - gson - - - com.google.android.gcm - gcm-server - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java deleted file mode 100644 index 1bf5322da..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, 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; - -import org.wso2.carbon.device.mgt.common.*; -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.operation.mgt.OperationManager; - -import java.util.List; - -public abstract class AbstractMobileOperationManager implements OperationManager { - - @Override - public List getOperations(DeviceIdentifier deviceIdentifier) throws OperationManagementException { - return null; - } - - @Override - public int addOperation(Operation operation, List devices) throws - OperationManagementException { - return 1; - } - -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceListener.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceListener.java deleted file mode 100644 index 649786c43..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2015, 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; - -public interface DataSourceListener { - - void notifyObserver(); - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceNotAvailableException.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceNotAvailableException.java deleted file mode 100644 index 5a9e5b8f4..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/DataSourceNotAvailableException.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * * - * * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * * - * * Licensed under the Apache License, Version 2.0 (the "License"); - * * you may not use this file except in compliance with the License. - * * You may obtain a copy of the License at - * * - * * http://www.apache.org/licenses/LICENSE-2.0 - * * - * * Unless required by applicable law or agreed to in writing, software - * * distributed under the License is distributed on an "AS IS" BASIS, - * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * See the License for the specific language governing permissions and - * * limitations under the License. - * - */ -package org.wso2.carbon.device.mgt.mobile; - -public class DataSourceNotAvailableException extends RuntimeException { - - private String message; - private static final long serialVersionUID = 2021891706072918866L; - - public DataSourceNotAvailableException(String message, Exception nestedException) { - super(message, nestedException); - setErrorMessage(message); - } - - public DataSourceNotAvailableException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public DataSourceNotAvailableException(String message) { - super(message); - setErrorMessage(message); - } - - public DataSourceNotAvailableException(Throwable cause) { - super(cause); - } - - public String getMessage() { - return message; - } - - public void setErrorMessage(String errorMessage) { - this.message = errorMessage; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobileDeviceMgtPluginException.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobileDeviceMgtPluginException.java deleted file mode 100644 index ef2871c28..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobileDeviceMgtPluginException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2015, 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.common; - - -public class MobileDeviceMgtPluginException extends Exception{ - - private static final long serialVersionUID = -2297311387874900305L; - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public MobileDeviceMgtPluginException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public MobileDeviceMgtPluginException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public MobileDeviceMgtPluginException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public MobileDeviceMgtPluginException() { - super(); - } - - public MobileDeviceMgtPluginException(Throwable cause) { - super(cause); - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobilePluginConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobilePluginConstants.java deleted file mode 100644 index 67e793fa5..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/common/MobilePluginConstants.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2015, 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.common; - -public class MobilePluginConstants { - public static final String MOBILE_DB_SCRIPTS_FOLDER = "cdm"; - public static final String MOBILE_CONFIG_REGISTRY_ROOT = "/_system/config"; - - public static final String MEDIA_TYPE_XML = "application/xml"; - public static final String CHARSET_UTF8 = "UTF8"; - public static final String LANGUAGE_CODE_ENGLISH_US = "en_US"; - public static final String LANGUAGE_CODE_ENGLISH_UK = "en_UK"; - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java deleted file mode 100644 index 07123434d..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceConfigurationManager.java +++ /dev/null @@ -1,79 +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.config; - -import org.w3c.dom.Document; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; -import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; -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/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementConfig.java deleted file mode 100644 index ced99f955..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/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.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/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/MobileDeviceManagementRepository.java deleted file mode 100644 index 88369dd84..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/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.config; - -import org.wso2.carbon.device.mgt.mobile.config.datasource.DataSourceConfigAdapter; -import org.wso2.carbon.device.mgt.mobile.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/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/DataSourceConfigAdapter.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/DataSourceConfigAdapter.java deleted file mode 100644 index 71675785c..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/DataSourceConfigAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2015, 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.config.datasource; - -import javax.xml.bind.annotation.adapters.XmlAdapter; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class DataSourceConfigAdapter - extends XmlAdapter> { - - @Override - public Map unmarshal(MobileDataSourceConfigurations mobileDataSourceConfigurations) - throws Exception { - - Map mobileDataSourceConfigMap = new HashMap(); - for (MobileDataSourceConfig mobileDataSourceConfig : mobileDataSourceConfigurations - .getMobileDataSourceConfigs()) { - mobileDataSourceConfigMap.put(mobileDataSourceConfig.getType(), mobileDataSourceConfig); - } - return mobileDataSourceConfigMap; - } - - @Override - public MobileDataSourceConfigurations marshal(Map mobileDataSourceConfigMap) - throws Exception { - - MobileDataSourceConfigurations mobileDataSourceConfigurations = new MobileDataSourceConfigurations(); - mobileDataSourceConfigurations.setMobileDataSourceConfigs( - (List) mobileDataSourceConfigMap.values()); - - return mobileDataSourceConfigurations; - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/JNDILookupDefinition.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/JNDILookupDefinition.java deleted file mode 100644 index 603adcedd..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/JNDILookupDefinition.java +++ /dev/null @@ -1,79 +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.config.datasource; - -import javax.xml.bind.annotation.*; -import java.util.List; - -/** - * Class for hold JndiLookupDefinition of mobile-config.xml at parsing with JAXB. - */ -@XmlRootElement(name = "JndiLookupDefinition") -public class JNDILookupDefinition { - - private String jndiName; - private List jndiProperties; - - @XmlElement(name = "Name", nillable = false) - public String getJndiName() { - return jndiName; - } - - public void setJndiName(String jndiName) { - this.jndiName = jndiName; - } - - @XmlElementWrapper(name = "Environment", nillable = false) - @XmlElement(name = "Property", nillable = false) - public List getJndiProperties() { - return jndiProperties; - } - - public void setJndiProperties(List jndiProperties) { - this.jndiProperties = jndiProperties; - } - - @XmlRootElement(name = "Property") - public static class JNDIProperty { - - private String name; - - private String value; - - @XmlAttribute(name = "Name") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @XmlValue - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } - -} - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java deleted file mode 100644 index 869aaf12e..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java +++ /dev/null @@ -1,51 +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.config.datasource; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Class for holding data source configuration in mobile-config.xml at parsing with JAXB. - */ -@XmlRootElement(name = "DataSourceConfiguration") -public class MobileDataSourceConfig { - - private JNDILookupDefinition jndiLookupDefinition; - private String type; - - @XmlElement(name = "JndiLookupDefinition", nillable = true) - public JNDILookupDefinition getJndiLookupDefinition() { - return jndiLookupDefinition; - } - - public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) { - this.jndiLookupDefinition = jndiLookupDefinition; - } - - @XmlAttribute(name = "type") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java deleted file mode 100644 index 17e80f5bf..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfigurations.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, 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.config.datasource; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - -@XmlRootElement(name = "DataSourceConfigurations") -@XmlAccessorType(XmlAccessType.FIELD) -public class MobileDataSourceConfigurations { - - @XmlElement(name = "DataSourceConfiguration", nillable = true) - private List mobileDataSourceConfigs; - - public List getMobileDataSourceConfigs() { - return mobileDataSourceConfigs; - } - - public void setMobileDataSourceConfigs(List mobileDataSourceConfigs) { - this.mobileDataSourceConfigs = mobileDataSourceConfigs; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/AbstractMobileDeviceManagementDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/AbstractMobileDeviceManagementDAOFactory.java deleted file mode 100644 index 32bcb8de7..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/AbstractMobileDeviceManagementDAOFactory.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2015, 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.dao; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.config.datasource.JNDILookupDefinition; -import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; -import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; - -import javax.sql.DataSource; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -/** - * Factory class used to create MobileDeviceManagement related DAO objects. - */ -public abstract class AbstractMobileDeviceManagementDAOFactory implements MobileDeviceManagementDAOFactory { - - private static final Log log = LogFactory.getLog(AbstractMobileDeviceManagementDAOFactory.class); - private static Map dataSourceMap = new HashMap<>(); - private static boolean isInitialized; - - public static void init(Map mobileDataSourceConfigMap) - throws MobileDeviceMgtPluginException { - DataSource dataSource; - for (String pluginType : mobileDataSourceConfigMap.keySet()) { - if (dataSourceMap.get(pluginType) == null) { - dataSource = AbstractMobileDeviceManagementDAOFactory.resolveDataSource(mobileDataSourceConfigMap.get - (pluginType)); - dataSourceMap.put(pluginType, dataSource); - } - } - isInitialized = true; - } - - public static void init(String key, MobileDataSourceConfig mobileDataSourceConfig) throws - MobileDeviceMgtPluginException { - DataSource dataSource = AbstractMobileDeviceManagementDAOFactory.resolveDataSource(mobileDataSourceConfig); - dataSourceMap.put(key, dataSource); - } - - /** - * Resolve data source from the data source definition. - * - * @param config Mobile data source configuration - * @return data source resolved from the data source definition - */ - public static DataSource resolveDataSource(MobileDataSourceConfig config) { - DataSource dataSource = null; - if (config == null) { - throw new RuntimeException("Device Management Repository data source configuration " + - "is null and thus, is not initialized"); - } - JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); - if (jndiConfig != null) { - if (log.isDebugEnabled()) { - log.debug("Initializing Device Management Repository data source using the JNDI " + - "Lookup Definition"); - } - List jndiPropertyList = - jndiConfig.getJndiProperties(); - if (jndiPropertyList != null) { - Hashtable jndiProperties = new Hashtable(); - for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { - jndiProperties.put(prop.getName(), prop.getValue()); - } - dataSource = - MobileDeviceManagementDAOUtil - .lookupDataSource(jndiConfig.getJndiName(), jndiProperties); - } else { - dataSource = MobileDeviceManagementDAOUtil - .lookupDataSource(jndiConfig.getJndiName(), null); - } - } - return dataSource; - } - - public static Map getDataSourceMap() { - return dataSourceMap; - } - -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java deleted file mode 100644 index 161594273..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2015, 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.dao; - -import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; -import java.util.List; - -/** - * This class represents the key operations associated with persisting mobile-device related - * information. - */ -public interface MobileDeviceDAO { - - /** - * Fetches a MobileDevice from MDM database. - * - * @param mblDeviceId Id of the Mobile-Device. - * @return MobileDevice corresponding to given device-id. - * @throws MobileDeviceManagementDAOException - */ - MobileDevice getMobileDevice(String mblDeviceId) throws MobileDeviceManagementDAOException; - - /** - * Adds a new MobileDevice to the MDM database. - * - * @param mobileDevice MobileDevice to be added. - * @return The status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean addMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException; - - /** - * Updates MobileDevice information in MDM database. - * - * @param mobileDevice MobileDevice to be updated. - * @return The status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean updateMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException; - - /** - * Deletes a given MobileDevice from MDM database. - * - * @param mblDeviceId Id of MobileDevice to be deleted. - * @return The status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean deleteMobileDevice(String mblDeviceId) throws MobileDeviceManagementDAOException; - - /** - * Fetches all MobileDevices from MDM database. - * - * @return List of MobileDevices. - * @throws MobileDeviceManagementDAOException - */ - List getAllMobileDevices() throws MobileDeviceManagementDAOException; - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOException.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOException.java deleted file mode 100644 index 0b04818d9..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOException.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2015, 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.dao; - -/** - * Custom exception class for mobile device specific data access related exceptions. - */ -public class MobileDeviceManagementDAOException extends Exception { - - private String message; - private static final long serialVersionUID = 2021891706072918865L; - - /** - * Constructs a new MobileDeviceManagementDAOException with the specified detail message and - * nested exception. - * - * @param message error message - * @param nestedException exception - */ - public MobileDeviceManagementDAOException(String message, Exception nestedException) { - super(message, nestedException); - setErrorMessage(message); - } - - /** - * Constructs a new MobileDeviceManagementDAOException with the specified detail message - * and cause. - * - * @param message the detail message. - * @param cause the cause of this exception. - */ - public MobileDeviceManagementDAOException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - /** - * Constructs a new MobileDeviceManagementDAOException with the specified detail message. - * - * @param message the detail message. - */ - public MobileDeviceManagementDAOException(String message) { - super(message); - setErrorMessage(message); - } - - /** - * Constructs a new MobileDeviceManagementDAOException with the specified and cause. - * - * @param cause the cause of this exception. - */ - public MobileDeviceManagementDAOException(Throwable cause) { - super(cause); - } - - public String getMessage() { - return message; - } - - public void setErrorMessage(String errorMessage) { - this.message = errorMessage; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java deleted file mode 100644 index 37a5c311c..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2015, 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.dao; - -public interface MobileDeviceManagementDAOFactory { - - MobileDeviceDAO getMobileDeviceDAO(); - - MobileFeatureDAO getMobileFeatureDAO(); - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileFeatureDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileFeatureDAO.java deleted file mode 100644 index 55c77424b..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileFeatureDAO.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2015, 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.dao; - -import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature; - -import java.util.List; - -/** - * This class represents the key operations associated with persisting mobile feature related - * information. - */ -public interface MobileFeatureDAO { - - /** - * Adds a new MobileFeature to Mobile-Feature table. - * - * @param mobileFeature MobileFeature object that holds data related to the feature to be inserted. - * @return boolean status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean addFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException; - - /** - * Adda a list of MobileFeatures to Mobile-Feature table. - * - * @param mobileFeatures List of MobileFeature objects. - * @return boolean status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean addFeatures(List mobileFeatures) throws MobileDeviceManagementDAOException; - - /** - * Updates a MobileFeature in Mobile-Feature table. - * - * @param mobileFeature MobileFeature object that holds data has to be updated. - * @return The status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean updateFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException; - - /** - * Deletes a MobileFeature from Mobile-Feature table when the feature id is given. - * - * @param mblFeatureId MobileFeature id of the MobileFeature to be deleted. - * @return The status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean deleteFeatureById(int mblFeatureId) throws MobileDeviceManagementDAOException; - - /** - * Deletes a MobileFeature from Mobile-Feature table when the feature code is given. - * - * @param mblFeatureCode MobileFeature code of the feature to be deleted. - * @return The status of the operation. - * @throws MobileDeviceManagementDAOException - */ - boolean deleteFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException; - - /** - * Retrieves a given MobileFeature from Mobile-Feature table when the feature id is given. - * - * @param mblFeatureId Feature id of the feature to be retrieved. - * @return MobileFeature object that holds data of the feature represented by featureId. - * @throws MobileDeviceManagementDAOException - */ - MobileFeature getFeatureById(int mblFeatureId) throws MobileDeviceManagementDAOException; - - /** - * Retrieves a given MobileFeature from Mobile-Feature table when the feature code is given. - * - * @param mblFeatureCode Feature code of the feature to be retrieved. - * @return MobileFeature object that holds data of the feature represented by featureCode. - * @throws MobileDeviceManagementDAOException - */ - MobileFeature getFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException; - - /** - * Retrieves all MobileFeatures of a MobileDevice type from Mobile-Feature table. - * - * @param deviceType MobileDevice type of the MobileFeatures to be retrieved - * @return MobileFeature object list. - * @throws MobileDeviceManagementDAOException - */ - List getFeatureByDeviceType(String deviceType) throws MobileDeviceManagementDAOException; - - /** - * Retrieve all the MobileFeatures from Mobile-Feature table. - * - * @return MobileFeature object list. - * @throws MobileDeviceManagementDAOException - */ - List getAllFeatures() throws MobileDeviceManagementDAOException; -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeatureDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeatureDAOImpl.java deleted file mode 100644 index 86a940fd6..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeatureDAOImpl.java +++ /dev/null @@ -1,336 +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.dao.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; -import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO; -import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; -import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature; - -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -/** - * Implementation of MobileFeatureDAO. - */ -public class MobileFeatureDAOImpl implements MobileFeatureDAO { - - private DataSource dataSource; - private static final Log log = LogFactory.getLog(MobileFeatureDAOImpl.class); - - public MobileFeatureDAOImpl(DataSource dataSource) { - this.dataSource = dataSource; - } - - @Override - public boolean addFeature(MobileFeature mobileFeature) - throws MobileDeviceManagementDAOException { - boolean status = false; - Connection conn = null; - PreparedStatement stmt = null; - try { - conn = this.getConnection(); - String createDBQuery = - "INSERT INTO AD_FEATURE(CODE, NAME, DESCRIPTION, DEVICE_TYPE) VALUES (?, ?, ?, ?)"; - - stmt = conn.prepareStatement(createDBQuery); - stmt.setString(1, mobileFeature.getCode()); - stmt.setString(2, mobileFeature.getName()); - stmt.setString(3, mobileFeature.getDescription()); - stmt.setString(4, mobileFeature.getDeviceType()); - int rows = stmt.executeUpdate(); - if (rows > 0) { - if (log.isDebugEnabled()) { - log.debug("Added a new MobileFeature " + mobileFeature.getCode() + " to the MDM database."); - } - status = true; - } - } catch (SQLException e) { - String msg = "Error occurred while adding feature code - '" + - mobileFeature.getCode() + "' to feature table"; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); - } - return status; - } - - @Override - public boolean addFeatures(List mobileFeatures) throws MobileDeviceManagementDAOException { - return false; - } - - @Override - public boolean updateFeature(MobileFeature mobileFeature) - throws MobileDeviceManagementDAOException { - boolean status = false; - Connection conn = null; - PreparedStatement stmt = null; - try { - conn = this.getConnection(); - String updateDBQuery = - "UPDATE AD_FEATURE SET CODE = ?, NAME = ?, DESCRIPTION = ?, DEVICE_TYPE = ?" + - " WHERE ID = ?"; - stmt = conn.prepareStatement(updateDBQuery); - stmt.setString(1, mobileFeature.getCode()); - stmt.setString(2, mobileFeature.getName()); - stmt.setString(3, mobileFeature.getDescription()); - stmt.setString(4, mobileFeature.getDeviceType()); - stmt.setInt(5, mobileFeature.getId()); - int rows = stmt.executeUpdate(); - if (rows > 0) { - status = true; - if (log.isDebugEnabled()) { - log.debug("Updated MobileFeature " + mobileFeature.getCode()); - } - } - } catch (SQLException e) { - String msg = "Error occurred while updating the feature with feature code - '" + - mobileFeature.getId() + "'"; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); - } - return status; - } - - @Override - public boolean deleteFeatureByCode(String mblFeatureCode) - throws MobileDeviceManagementDAOException { - boolean status = false; - Connection conn = null; - PreparedStatement stmt = null; - try { - conn = this.getConnection(); - String deleteDBQuery = - "DELETE FROM AD_FEATURE WHERE CODE = ?"; - stmt = conn.prepareStatement(deleteDBQuery); - stmt.setString(1, mblFeatureCode); - int rows = stmt.executeUpdate(); - if (rows > 0) { - status = true; - if (log.isDebugEnabled()) { - log.debug("Deleted MobileFeature code " + mblFeatureCode + " from the MDM database."); - } - } - } catch (SQLException e) { - String msg = "Error occurred while deleting feature with code - " + mblFeatureCode; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); - } - return status; - } - - @Override - public boolean deleteFeatureById(int mblFeatureId) - throws MobileDeviceManagementDAOException { - boolean status = false; - Connection conn = null; - PreparedStatement stmt = null; - try { - conn = this.getConnection(); - String deleteDBQuery = - "DELETE FROM AD_FEATURE WHERE ID = ?"; - stmt = conn.prepareStatement(deleteDBQuery); - stmt.setInt(1, mblFeatureId); - int rows = stmt.executeUpdate(); - if (rows > 0) { - status = true; - if (log.isDebugEnabled()) { - log.debug("Deleted MobileFeature id " + mblFeatureId + " from the MDM database."); - } - } - } catch (SQLException e) { - String msg = "Error occurred while deleting feature with id - " + mblFeatureId; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); - } - return status; - } - - @Override - public MobileFeature getFeatureByCode(String mblFeatureCode) - throws MobileDeviceManagementDAOException { - Connection conn = null; - PreparedStatement stmt = null; - MobileFeature mobileFeature = null; - ResultSet resultSet = null; - try { - conn = this.getConnection(); - String selectDBQuery = - "SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE " + - "WHERE CODE = ?"; - stmt = conn.prepareStatement(selectDBQuery); - stmt.setString(1, mblFeatureCode); - resultSet = stmt.executeQuery(); - if (resultSet.next()) { - mobileFeature = new MobileFeature(); - mobileFeature.setId(resultSet.getInt(1)); - mobileFeature.setCode(resultSet.getString(2)); - mobileFeature.setName(resultSet.getString(3)); - mobileFeature.setDescription(resultSet.getString(4)); - mobileFeature.setDeviceType(resultSet.getString(5)); - if (log.isDebugEnabled()) { - log.debug("Fetched MobileFeature " + mblFeatureCode + " from the MDM database."); - } - } - } catch (SQLException e) { - String msg = "Error occurred while fetching feature code - '" + mblFeatureCode + "'"; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet); - } - return mobileFeature; - } - - @Override - public MobileFeature getFeatureById(int mblFeatureId) - throws MobileDeviceManagementDAOException { - Connection conn = null; - PreparedStatement stmt = null; - MobileFeature mobileFeature = null; - ResultSet resultSet = null; - try { - conn = this.getConnection(); - String selectDBQuery = - "SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE" + - " WHERE ID = ?"; - stmt = conn.prepareStatement(selectDBQuery); - stmt.setInt(1, mblFeatureId); - resultSet = stmt.executeQuery(); - if (resultSet.next()) { - mobileFeature = new MobileFeature(); - mobileFeature.setId(resultSet.getInt(1)); - mobileFeature.setCode(resultSet.getString(2)); - mobileFeature.setName(resultSet.getString(3)); - mobileFeature.setDescription(resultSet.getString(4)); - mobileFeature.setDeviceType(resultSet.getString(5)); - if (log.isDebugEnabled()) { - log.debug("Fetched MobileFeatureId" + mblFeatureId + " from the MDM database."); - } - } - } catch (SQLException e) { - String msg = "Error occurred while fetching feature id - '" + mblFeatureId + "'"; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet); - } - return mobileFeature; - } - - @Override - public List getAllFeatures() throws MobileDeviceManagementDAOException { - Connection conn = null; - PreparedStatement stmt = null; - MobileFeature mobileFeature; - List mobileFeatures = new ArrayList(); - ResultSet resultSet = null; - try { - conn = this.getConnection(); - String selectDBQuery = - "SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE"; - stmt = conn.prepareStatement(selectDBQuery); - resultSet = stmt.executeQuery(); - while (resultSet.next()) { - mobileFeature = new MobileFeature(); - mobileFeature.setId(resultSet.getInt(1)); - mobileFeature.setCode(resultSet.getString(2)); - mobileFeature.setName(resultSet.getString(3)); - mobileFeature.setDescription(resultSet.getString(4)); - mobileFeature.setDeviceType(resultSet.getString(5)); - mobileFeatures.add(mobileFeature); - } - if (log.isDebugEnabled()) { - log.debug("Fetched all MobileFeatures from the MDM database."); - } - return mobileFeatures; - } catch (SQLException e) { - String msg = "Error occurred while fetching all features.'"; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet); - } - } - - @Override - public List getFeatureByDeviceType(String deviceType) throws MobileDeviceManagementDAOException { - Connection conn = null; - PreparedStatement stmt = null; - MobileFeature mobileFeature; - List mobileFeatures = new ArrayList<>(); - ResultSet resultSet = null; - try { - conn = this.getConnection(); - String selectDBQuery = - "SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE" + - " WHERE DEVICE_TYPE = ?"; - stmt = conn.prepareStatement(selectDBQuery); - stmt.setString(1, deviceType); - resultSet = stmt.executeQuery(); - while (resultSet.next()) { - mobileFeature = new MobileFeature(); - mobileFeature.setId(resultSet.getInt(1)); - mobileFeature.setCode(resultSet.getString(2)); - mobileFeature.setName(resultSet.getString(3)); - mobileFeature.setDescription(resultSet.getString(4)); - mobileFeature.setDeviceType(resultSet.getString(5)); - mobileFeatures.add(mobileFeature); - } - if (log.isDebugEnabled()) { - log.debug("Fetched all MobileFeatures of type " + deviceType + " from the MDM" + - " database."); - } - return mobileFeatures; - } catch (SQLException e) { - String msg = "Error occurred while fetching all features.'"; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } finally { - MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet); - } - } - - private Connection getConnection() throws MobileDeviceManagementDAOException { - try { - return dataSource.getConnection(); - } catch (SQLException e) { - String msg = "Error occurred while obtaining a connection from the mobile specific " + - "datasource."; - log.error(msg, e); - throw new MobileDeviceManagementDAOException(msg, e); - } - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java deleted file mode 100644 index 0f72e82e9..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2015, 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.dao.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.config.datasource.JNDILookupDefinition; -import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; -import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementSchemaInitializer; - -import javax.naming.InitialContext; -import javax.sql.DataSource; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Hashtable; -import java.util.List; - -/** - * Utility method required by MobileDeviceManagement DAO classes. - */ -public class MobileDeviceManagementDAOUtil { - - private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOUtil.class); - - public static DataSource lookupDataSource(String dataSourceName, - final Hashtable jndiProperties){ - - try { - if (jndiProperties == null || jndiProperties.isEmpty()) { - return (DataSource) InitialContext.doLookup(dataSourceName); - } - final InitialContext context = new InitialContext(jndiProperties); - return (DataSource) context.lookup(dataSourceName); - } catch (Exception e) { - String msg = "Error in looking up data source: " + e.getMessage(); - log.error(msg, e); - throw new RuntimeException(msg + e.getMessage(), e); - } - } - - public static void cleanupResources(Connection conn, PreparedStatement stmt, ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing result set", e); - } - } - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing prepared statement", e); - } - } - if (conn != null) { - try { - conn.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing database connection", e); - } - } - } - - public static void cleanupResources(PreparedStatement stmt, ResultSet rs) { - cleanupResources(null, stmt, rs); - } - - /** - * Creates the mobile device management schema. - * - * @param dataSource Mobile data source - */ - public static void setupMobileDeviceManagementSchema(DataSource dataSource, String pluginType) throws MobileDeviceMgtPluginException { - MobileDeviceManagementSchemaInitializer initializer = - new MobileDeviceManagementSchemaInitializer(dataSource, pluginType); - log.info("Initializing mobile device management repository database schema for : " + pluginType); - try { - initializer.createRegistryDatabase(); - } catch (Exception e) { - throw new MobileDeviceMgtPluginException("Error occurred while initializing Mobile Device " + - "Management database schema", e); - } - } - - - /** - * Resolve data source from the data source definition - * - * @param config data source configuration - * @return data source resolved from the data source definition - */ - private static DataSource resolveDataSource(MobileDataSourceConfig config) { - DataSource dataSource = null; - if (config == null) { - throw new RuntimeException( - "data source configuration " + "is null and " + - "thus, is not initialized"); - } - JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); - if (jndiConfig != null) { - if (log.isDebugEnabled()) { - log.debug("Initializing data source using the JNDI " + - "Lookup Definition"); - } - List jndiPropertyList = - jndiConfig.getJndiProperties(); - if (jndiPropertyList != null) { - Hashtable jndiProperties = new Hashtable(); - for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { - jndiProperties.put(prop.getName(), prop.getValue()); - } - dataSource = MobileDeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties); - } else { - dataSource = MobileDeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); - } - } - return dataSource; - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDevice.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDevice.java deleted file mode 100644 index 185168da4..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDevice.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2015, 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.dto; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -/** - * DTO of MobileDevice. - */ -public class MobileDevice implements Serializable { - - private String mobileDeviceId; - private String osVersion; - private String model; - private String vendor; - private String latitude; - private String longitude; - private String imei; - private String imsi; - private String serial; - private Map deviceProperties; - - public MobileDevice() { - this.deviceProperties = new HashMap<>(); - } - - public String getMobileDeviceId() { - return mobileDeviceId; - } - - public void setMobileDeviceId(String mobileDeviceId) { - this.mobileDeviceId = mobileDeviceId; - } - - public String getOsVersion() { - return osVersion; - } - - public void setOsVersion(String osVersion) { - this.osVersion = osVersion; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public String getVendor() { - return vendor; - } - - public void setVendor(String vendor) { - this.vendor = vendor; - } - - public String getLatitude() { - return latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getLongitude() { - return longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getImei() { - return imei; - } - - public void setImei(String imei) { - this.imei = imei; - } - - public String getImsi() { - return imsi; - } - - public void setImsi(String imsi) { - this.imsi = imsi; - } - - public String getSerial() { - return serial; - } - - public void setSerial(String serial) { - this.serial = serial; - } - - public Map getDeviceProperties() { - return deviceProperties; - } - - public void setDeviceProperties(Map deviceProperties) { - this.deviceProperties = deviceProperties; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDeviceOperationMapping.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDeviceOperationMapping.java deleted file mode 100644 index 0ae7e68fa..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileDeviceOperationMapping.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2015, 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.dto; - -/** - * DTO of Mobile Device Operation Mappings. - */ -public class MobileDeviceOperationMapping { - - private String deviceId; - private int operationId; - private long sentDate; - private long receivedDate; - private Status status; - - public enum Status { - NEW, INPROGRESS, COMPLETED - } - - public Status getStatus() { - return status; - } - - public void setStatus(Status status) { - this.status = status; - } - - public void setStatus(String status) { - if(Status.NEW.name().equals(status)){ - this.status = Status.NEW; - }else if(Status.INPROGRESS.name().equals(status)){ - this.status = Status.INPROGRESS; - }else if(Status.COMPLETED.name().equals(status)){ - this.status = Status.COMPLETED; - } - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public int getOperationId() { - return operationId; - } - - public void setOperationId(int operationId) { - this.operationId = operationId; - } - - public long getSentDate() { - return sentDate; - } - - public void setSentDate(long sentDate) { - this.sentDate = sentDate; - } - - public long getReceivedDate() { - return receivedDate; - } - - public void setReceivedDate(long receivedDate) { - this.receivedDate = receivedDate; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeature.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeature.java deleted file mode 100644 index 9ec5d30b3..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeature.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2015, 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.dto; - -import java.io.Serializable; - -/** - * DTO of Mobile features. - */ -public class MobileFeature implements Serializable { - - private int id; - private String deviceType; - private String code; - private String name; - private String description; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDeviceType() { - return deviceType; - } - - public void setDeviceType(String deviceType) { - this.deviceType = deviceType; - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeatureProperty.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeatureProperty.java deleted file mode 100644 index cc99849de..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileFeatureProperty.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015, 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.dto; - -/** - * DTO of Mobile feature property. Represents a property of a mobile feature. - */ -public class MobileFeatureProperty { - - private String property; - private Integer featureID; - - public Integer getFeatureID() { - return featureID; - } - - public void setFeatureID(Integer featureID) { - this.featureID = featureID; - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } - -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperation.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperation.java deleted file mode 100644 index 7c0b9040c..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperation.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015, 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.dto; - -import java.util.List; - -/** - * DTO of MobileOperation. - */ -public class MobileOperation { - - private int operationId; - private String featureCode; - private long createdDate; - private List properties; - - public int getOperationId() { - return operationId; - } - - public void setOperationId(int operationId) { - this.operationId = operationId; - } - - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - public String getFeatureCode() { - return featureCode; - } - - public void setFeatureCode(String featureCode) { - this.featureCode = featureCode; - } - - public long getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(long createdDate) { - this.createdDate = createdDate; - } -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperationProperty.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperationProperty.java deleted file mode 100644 index d18126aff..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dto/MobileOperationProperty.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2015, 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.dto; - -/** - * DTO of Mobile Operation property. - */ -public class MobileOperationProperty { - - private int operationId; - private String property; - private String value; - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public int getOperationId() { - return operationId; - } - - public void setOperationId(int operationId) { - this.operationId = operationId; - } - - public String getProperty() { - return property; - } - - public void setProperty(String property) { - this.property = property; - } - -} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java deleted file mode 100644 index 869904e81..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2015, 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.internal; - -import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.impl.android.gcm.GCMService; -import org.wso2.carbon.registry.core.service.RegistryService; - -/** - * DataHolder class of Mobile plugins component. - */ -public class MobileDeviceManagementDataHolder { - - private RegistryService registryService; - private DeviceManagementService androidDeviceManagementService; - private GCMService gcmService; - - private static MobileDeviceManagementDataHolder thisInstance = new MobileDeviceManagementDataHolder(); - - private MobileDeviceManagementDataHolder() { - } - - public static MobileDeviceManagementDataHolder getInstance() { - return thisInstance; - } - - public RegistryService getRegistryService() { - return registryService; - } - - public void setRegistryService(RegistryService registryService) { - this.registryService = registryService; - } - - public DeviceManagementService getAndroidDeviceManagementService() { - return androidDeviceManagementService; - } - - public void setAndroidDeviceManagementService( - DeviceManagementService androidDeviceManagementService) { - this.androidDeviceManagementService = androidDeviceManagementService; - } - - public GCMService getGCMService() { - return gcmService; - } - - public void setGCMService(GCMService gcmService) { - this.gcmService = gcmService; - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java deleted file mode 100644 index 92404b67a..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2015, 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.internal; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager; -import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig; -import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; -import org.wso2.carbon.device.mgt.mobile.dao.AbstractMobileDeviceManagementDAOFactory; -import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; -import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidPolicyMonitoringService; -import org.wso2.carbon.device.mgt.mobile.impl.android.gcm.GCMService; -import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsPolicyMonitoringService; -import org.wso2.carbon.ndatasource.core.DataSourceService; -import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; -import org.wso2.carbon.registry.core.service.RegistryService; - -import java.util.Map; - -/** - * @scr.component name="org.wso2.carbon.device.mgt.mobile.impl.internal.MobileDeviceManagementServiceComponent" - * immediate="true" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="0..1" - * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" - *

- * Adding reference to API Manager Configuration service is an unavoidable hack to get rid of NPEs thrown while - * initializing APIMgtDAOs attempting to register APIs programmatically. APIMgtDAO needs to be proper cleaned up - * to avoid as an ideal fix - */ -public class MobileDeviceManagementServiceComponent { - - private ServiceRegistration androidServiceRegRef; - private ServiceRegistration windowsServiceRegRef; - private ServiceRegistration gcmServiceRegRef; - - private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class); - - protected void activate(ComponentContext ctx) { - - if (log.isDebugEnabled()) { - log.debug("Activating Mobile Device Management Service Component"); - } - try { - BundleContext bundleContext = ctx.getBundleContext(); - - /* Initialize the data source configuration */ - MobileDeviceConfigurationManager.getInstance().initConfig(); - MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() - .getMobileDeviceManagementConfig(); - Map dsConfigMap = - config.getMobileDeviceMgtRepository().getMobileDataSourceConfigMap(); - - AbstractMobileDeviceManagementDAOFactory.init(dsConfigMap); - - String setupOption = System.getProperty("setup"); - if (setupOption != null) { - if (log.isDebugEnabled()) { - log.debug( - "-Dsetup is enabled. Mobile Device management repository schema initialization is about " + - "to begin"); - } - try { - for (String pluginType : dsConfigMap.keySet()) { - MobileDeviceManagementDAOUtil - .setupMobileDeviceManagementSchema(AbstractMobileDeviceManagementDAOFactory.getDataSourceMap - ().get(pluginType), pluginType); - } - } catch (MobileDeviceMgtPluginException e) { - log.error("Exception occurred while initializing mobile device management database schema", e); - } - } - DeviceManagementService androidDeviceManagementService = new AndroidDeviceManagementService(); - GCMService gcmService = new GCMService(); - - androidServiceRegRef = - bundleContext.registerService(DeviceManagementService.class.getName(), - androidDeviceManagementService, null); - windowsServiceRegRef = - bundleContext.registerService(DeviceManagementService.class.getName(), - new WindowsDeviceManagementService(), null); - - gcmServiceRegRef = - bundleContext.registerService(GCMService.class.getName(), gcmService, null); - - - // Policy management service - - bundleContext.registerService(PolicyMonitoringService.class, - new AndroidPolicyMonitoringService(), null); - bundleContext.registerService(PolicyMonitoringService.class, - new WindowsPolicyMonitoringService(), null); - - MobileDeviceManagementDataHolder.getInstance().setAndroidDeviceManagementService( - androidDeviceManagementService); - MobileDeviceManagementDataHolder.getInstance().setGCMService(gcmService); - if (log.isDebugEnabled()) { - log.debug("Mobile Device Management Service Component has been successfully activated"); - } - } catch (Throwable e) { - log.error("Error occurred while activating Mobile Device Management Service Component", e); - } - } - - protected void deactivate(ComponentContext ctx) { - if (log.isDebugEnabled()) { - log.debug("De-activating Mobile Device Management Service Component"); - } - try { - if (androidServiceRegRef != null) { - androidServiceRegRef.unregister(); - } - if (windowsServiceRegRef != null) { - windowsServiceRegRef.unregister(); - } - if (gcmServiceRegRef != null) { - gcmServiceRegRef.unregister(); - } - if (log.isDebugEnabled()) { - log.debug( - "Mobile Device Management Service Component has been successfully de-activated"); - } - } catch (Throwable e) { - log.error("Error occurred while de-activating Mobile Device Management bundle", e); - } - } - - protected void setDataSourceService(DataSourceService dataSourceService) { - /* This is to avoid mobile device management component getting initialized before the underlying datasources - are registered */ - if (log.isDebugEnabled()) { - log.debug("Data source service set to mobile service component"); - } - } - - protected void unsetDataSourceService(DataSourceService dataSourceService) { - //do nothing - } - - protected void setRegistryService(RegistryService registryService) { - if (log.isDebugEnabled()) { - log.debug("RegistryService acquired"); - } - MobileDeviceManagementDataHolder.getInstance().setRegistryService(registryService); - } - - protected void unsetRegistryService(RegistryService registryService) { - MobileDeviceManagementDataHolder.getInstance().setRegistryService(null); - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementSchemaInitializer.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementSchemaInitializer.java deleted file mode 100644 index f0071a85f..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementSchemaInitializer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2015, 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.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.common.MobilePluginConstants; -import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.dbcreator.DatabaseCreator; - -import javax.sql.DataSource; -import java.io.File; - -/** - * - * Provides methods for initializing the database script. - * - */ -public final class MobileDeviceManagementSchemaInitializer extends DatabaseCreator { - - private static final Log log = LogFactory.getLog(MobileDeviceManagementSchemaInitializer.class); - private static final String setupSQLScriptBaseLocation = - CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator - + MobilePluginConstants.MOBILE_DB_SCRIPTS_FOLDER + - File.separator + "plugins" + File.separator; - private String pluginType; - - public String getPluginType() { - return pluginType; - } - - public MobileDeviceManagementSchemaInitializer(DataSource dataSource, String pType) { - super(dataSource); - this.pluginType = pType; - } - - protected String getDbScriptLocation(String databaseType) { - String scriptName = databaseType + ".sql"; - String scriptLocation = setupSQLScriptBaseLocation + this.getPluginType() + File.separator + scriptName; - if (log.isDebugEnabled()) { - log.debug("Loading database script from :" + scriptLocation); - } - return scriptLocation; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java deleted file mode 100644 index 73612a365..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2015, 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.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.Device; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.Feature; -import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.mobile.common.MobilePluginConstants; -import org.wso2.carbon.device.mgt.mobile.dto.*; -import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder; -import org.wso2.carbon.registry.api.RegistryException; -import org.wso2.carbon.registry.api.Resource; -import org.wso2.carbon.registry.core.Registry; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; -import java.util.*; - -/** - * Provides utility methods required by the mobile device management bundle. - */ -public class MobileDeviceManagementUtil { - - private static final Log log = LogFactory.getLog(MobileDeviceManagementUtil.class); - private static final String MOBILE_DEVICE_IMEI = "IMEI"; - private static final String MOBILE_DEVICE_IMSI = "IMSI"; - private static final String MOBILE_DEVICE_VENDOR = "VENDOR"; - private static final String MOBILE_DEVICE_OS_VERSION = "OS_VERSION"; - private static final String MOBILE_DEVICE_MODEL = "DEVICE_MODEL"; - private static final String MOBILE_DEVICE_LATITUDE = "LATITUDE"; - private static final String MOBILE_DEVICE_LONGITUDE = "LONGITUDE"; - private static final String MOBILE_DEVICE_SERIAL = "SERIAL"; - - public static Document convertToDocument(File file) throws DeviceManagementException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - return docBuilder.parse(file); - } catch (Exception e) { - throw new DeviceManagementException( - "Error occurred while parsing file, while converting " + - "to a org.w3c.dom.Document : " + e.getMessage(), e); - } - } - - private static String getPropertyValue(Device device, String property) { - for (Device.Property prop : device.getProperties()) { - if (property.equals(prop.getName())) { - return prop.getValue(); - } - } - return null; - } - - private static Device.Property getProperty(String property, String value) { - if (property != null) { - Device.Property prop = new Device.Property(); - prop.setName(property); - prop.setValue(value); - return prop; - } - return null; - } - - public static MobileDevice convertToMobileDevice(Device device) { - MobileDevice mobileDevice = null; - if (device != null) { - mobileDevice = new MobileDevice(); - mobileDevice.setMobileDeviceId(device.getDeviceIdentifier()); - mobileDevice.setImei(getPropertyValue(device, MOBILE_DEVICE_IMEI)); - mobileDevice.setImsi(getPropertyValue(device, MOBILE_DEVICE_IMSI)); - mobileDevice.setModel(getPropertyValue(device, MOBILE_DEVICE_MODEL)); - mobileDevice.setOsVersion(getPropertyValue(device, MOBILE_DEVICE_OS_VERSION)); - mobileDevice.setVendor(getPropertyValue(device, MOBILE_DEVICE_VENDOR)); - mobileDevice.setLatitude(getPropertyValue(device, MOBILE_DEVICE_LATITUDE)); - mobileDevice.setLongitude(getPropertyValue(device, MOBILE_DEVICE_LONGITUDE)); - - if (device.getProperties() != null) { - Map deviceProperties = new HashMap(); - for (Device.Property deviceProperty : device.getProperties()) { - deviceProperties.put(deviceProperty.getName(), deviceProperty.getValue()); - } - - mobileDevice.setDeviceProperties(deviceProperties); - } else { - mobileDevice.setDeviceProperties(new HashMap()); - } - } - return mobileDevice; - } - - public static Device convertToDevice(MobileDevice mobileDevice) { - Device device = null; - if (mobileDevice != null) { - device = new Device(); - List propertyList = new ArrayList(); - propertyList.add(getProperty(MOBILE_DEVICE_IMEI, mobileDevice.getImei())); - propertyList.add(getProperty(MOBILE_DEVICE_IMSI, mobileDevice.getImsi())); - propertyList.add(getProperty(MOBILE_DEVICE_MODEL, mobileDevice.getModel())); - propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion())); - propertyList.add(getProperty(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor())); - if(mobileDevice.getLatitude() != null) { - propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude())); - } - if(mobileDevice.getLongitude() != null) { - propertyList.add(getProperty(MOBILE_DEVICE_LONGITUDE, mobileDevice.getLongitude())); - } - propertyList.add(getProperty(MOBILE_DEVICE_SERIAL, mobileDevice.getSerial())); - - if (mobileDevice.getDeviceProperties() != null) { - for (Map.Entry deviceProperty : mobileDevice.getDeviceProperties() - .entrySet()) { - propertyList - .add(getProperty(deviceProperty.getKey(), deviceProperty.getValue())); - } - } - - device.setProperties(propertyList); - device.setDeviceIdentifier(mobileDevice.getMobileDeviceId()); - } - return device; - } - - public static MobileOperation convertToMobileOperation(Operation operation) { - MobileOperation mobileOperation = new MobileOperation(); - MobileOperationProperty operationProperty; - List properties = new LinkedList(); - mobileOperation.setFeatureCode(operation.getCode()); - mobileOperation.setCreatedDate(new Date().getTime()); - Properties operationProperties = operation.getProperties(); - for (String key : operationProperties.stringPropertyNames()) { - operationProperty = new MobileOperationProperty(); - operationProperty.setProperty(key); - operationProperty.setValue(operationProperties.getProperty(key)); - properties.add(operationProperty); - } - mobileOperation.setProperties(properties); - return mobileOperation; - } - - public static List getMobileOperationIdsFromMobileDeviceOperations( - List mobileDeviceOperationMappings) { - List mobileOperationIds = new ArrayList(mobileDeviceOperationMappings.size()); - for (MobileDeviceOperationMapping mobileDeviceOperationMapping : mobileDeviceOperationMappings) { - mobileOperationIds.add(mobileDeviceOperationMapping.getOperationId()); - } - return mobileOperationIds; - } - - public static Operation convertMobileOperationToOperation(MobileOperation mobileOperation) { - Operation operation = new Operation(); - Properties properties = new Properties(); - operation.setCode(mobileOperation.getFeatureCode()); - for (MobileOperationProperty mobileOperationProperty : mobileOperation.getProperties()) { - properties - .put(mobileOperationProperty.getProperty(), mobileOperationProperty.getValue()); - } - operation.setProperties(properties); - return operation; - } - - public static MobileFeature convertToMobileFeature(Feature feature) { - MobileFeature mobileFeature = new MobileFeature(); - mobileFeature.setName(feature.getName()); - mobileFeature.setCode(feature.getCode()); - mobileFeature.setDescription(feature.getDescription()); - mobileFeature.setDeviceType(feature.getDeviceType()); - return mobileFeature; - } - - public static Feature convertToFeature(MobileFeature mobileFeature) { - Feature feature = new Feature(); - feature.setDescription(mobileFeature.getDescription()); - feature.setDeviceType(mobileFeature.getDeviceType()); - feature.setCode(mobileFeature.getCode()); - feature.setName(mobileFeature.getName()); - return feature; - } - - public static Registry getConfigurationRegistry() throws MobileDeviceMgtPluginException { - try { - int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); - return MobileDeviceManagementDataHolder.getInstance().getRegistryService() - .getConfigSystemRegistry( - tenantId); - } catch (RegistryException e) { - throw new MobileDeviceMgtPluginException( - "Error in retrieving conf registry instance: " + - e.getMessage(), e); - } - } - - public static Resource getRegistryResource(String path) throws MobileDeviceMgtPluginException { - try { - if(MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)){ - return MobileDeviceManagementUtil.getConfigurationRegistry().get(path); - } - return null; - } catch (RegistryException e) { - throw new MobileDeviceMgtPluginException("Error in retrieving registry resource : " + - e.getMessage(), e); - } - } - - public static boolean putRegistryResource(String path, - Resource resource) - throws MobileDeviceMgtPluginException { - boolean status; - try { - MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction(); - MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource); - MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction(); - status = true; - } catch (RegistryException e) { - throw new MobileDeviceMgtPluginException( - "Error occurred while persisting registry resource : " + - e.getMessage(), e); - } - return status; - } - - public static String getResourcePath(String resourceName, String platform) { - String regPath = ""; - switch (platform) { - case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID: - regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" + - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID + - "/" + resourceName; - break; - case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS: - regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" + - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS + - "/" + resourceName; - break; - case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS: - regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" + - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS + - "/" + resourceName; - break; - } - return regPath; - } - - public static String getPlatformConfigPath(String platform) { - String regPath = ""; - switch (platform) { - case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID: - regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID; - break; - case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS: - regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS; - break; - case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS: - regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS; - break; - } - return regPath; - } - - public static boolean createRegistryCollection(String path) - throws MobileDeviceMgtPluginException { - try { - if (! MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)) { - Resource resource = MobileDeviceManagementUtil.getConfigurationRegistry().newCollection(); - MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction(); - MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource); - MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction(); - } - return true; - } catch (MobileDeviceMgtPluginException e) { - throw new MobileDeviceMgtPluginException( - "Error occurred while creating a registry collection : " + - e.getMessage(), e); - } catch (RegistryException e) { - throw new MobileDeviceMgtPluginException( - "Error occurred while creating a registry collection : " + - e.getMessage(), e); - } - } - - public static List getMissingFeatures(List supportedFeatures, List existingFeatures) { - HashMap featureHashMap = new HashMap(); - for (Feature feature: existingFeatures) { - featureHashMap.put(feature.getCode(),feature); - } - List missingFeatures = new ArrayList(); - for (Feature supportedFeature : supportedFeatures) { - if (featureHashMap.get(supportedFeature.getCode()) != null) { - continue; - } - missingFeatures.add(supportedFeature); - } - return missingFeatures; - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConfigTests.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConfigTests.java deleted file mode 100644 index 461de8a1a..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/MobileDeviceManagementConfigTests.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2015, 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.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import javax.xml.XMLConstants; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import java.io.File; - -/** - * Class for holding unit-tests related to MobileDeviceManagementConfig class. - */ - -public class MobileDeviceManagementConfigTests { - - private static final Log log = LogFactory.getLog(MobileDeviceManagementConfigTests.class); - private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_MGT_REPOSITORY = - "./src/test/resources/config/malformed-mobile-config-no-mgt-repo.xml"; - private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_DS_CONFIG = - "./src/test/resources/config/malformed-mobile-config-no-ds-config.xml"; - private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_JNDI_CONFIG = - "./src/test/resources/config/malformed-mobile-config-no-jndi-config.xml"; - private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_APIS_CONFIG = - "./src/test/resources/config/malformed-mobile-config-no-apis-config.xml"; - private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_API_CONFIG = - "./src/test/resources/config/malformed-mobile-config-no-api-config.xml"; - private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_API_PUBLISHER_CONFIG = - "./src/test/resources/config/malformed-mobile-config-no-api-publisher-config.xml"; - private static final String TEST_CONFIG_SCHEMA_LOCATION = - "./src/test/resources/config/schema/MobileDeviceManagementConfigSchema.xsd"; - - private Schema schema; - - @BeforeClass - private void initSchema() { - File deviceManagementSchemaConfig = - new File(MobileDeviceManagementConfigTests.TEST_CONFIG_SCHEMA_LOCATION); - SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - try { - schema = factory.newSchema(deviceManagementSchemaConfig); - } catch (SAXException e) { - Assert.fail("Invalid schema found", e); - } - } - - @Test - public void testMandateManagementRepositoryElement() { - File malformedConfig = - new File( - MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_MGT_REPOSITORY); - this.validateMalformedConfig(malformedConfig); - } - - @Test - public void testMandateDataSourceConfigurationElement() { - File malformedConfig = new File( - MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_DS_CONFIG); - this.validateMalformedConfig(malformedConfig); - } - - @Test - public void testMandateJndiLookupDefinitionElement() { - File malformedConfig = new File( - MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_JNDI_CONFIG); - this.validateMalformedConfig(malformedConfig); - } - - @Test - public void testMandateAPIPublisherElement() { - File malformedConfig = new File( - MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_PUBLISHER_CONFIG); - this.validateMalformedConfig(malformedConfig); - } - - @Test - public void testMandateAPIsElement() { - File malformedConfig = new File( - MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_APIS_CONFIG); - this.validateMalformedConfig(malformedConfig); - } - - @Test - public void testMandateAPIElement() { - File malformedConfig = new File( - MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_CONFIG); - this.validateMalformedConfig(malformedConfig); - } - - /** - * Validates a given malformed-configuration file. - */ - private void validateMalformedConfig(File malformedConfig) { - try { - JAXBContext ctx = JAXBContext.newInstance(MobileDeviceManagementConfig.class); - Unmarshaller um = ctx.createUnmarshaller(); - um.setSchema(this.getSchema()); - um.unmarshal(malformedConfig); - Assert.assertTrue(false); - } catch (JAXBException e) { - Throwable linkedException = e.getLinkedException(); - if (!(linkedException instanceof SAXParseException)) { - log.error("Unexpected error occurred while unmarshalling mobile device management config", e); - Assert.assertTrue(false); - } - Assert.assertTrue(true); - } - } - - private Schema getSchema() { - return schema; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/DBTypes.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/DBTypes.java deleted file mode 100644 index fa263f384..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/DBTypes.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2015, 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.impl.common; - - -public enum DBTypes { - Oracle("Oracle"),H2("H2"),MySql("MySql"); - - String dbName ; - DBTypes(String dbStrName) { - dbName = dbStrName; - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfiguration.java deleted file mode 100644 index 042e105bf..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfiguration.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015, 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.impl.common; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "Type") -public class TestDBConfiguration { - - private String connectionURL; - private String driverClassName; - private String username; - private String password; - - @Override public String toString() { - return "TestDataSourceConfiguration{" + - "ConnectionURL='" + connectionURL + '\'' + - ", DriverClassName='" + driverClassName + '\'' + - ", Username='" + username + '\'' + - ", Password='" + password + '\'' + - ", Type='" + dbType + '\'' + - '}'; - } - - private String dbType; - - @XmlElement(name = "ConnectionURL", nillable = false) - public String getConnectionURL() { - return connectionURL; - } - - public void setConnectionURL(String connectionURL) { - this.connectionURL = connectionURL; - } - - @XmlElement(name = "DriverClassName", nillable = false) - public String getDriverClassName() { - return driverClassName; - } - - public void setDriverClassName(String driverClassName) { - this.driverClassName = driverClassName; - } - - @XmlElement(name = "Username", nillable = false) - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - @XmlElement(name = "Password", nillable = false) - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @XmlAttribute(name = "name") - public String getType() { - return dbType; - } - - public void setType(String type) { - this.dbType = type; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java deleted file mode 100644 index 88092ea41..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/common/TestDBConfigurations.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2015, 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.impl.common; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; - -@XmlRootElement(name = "TestDataSourceConfigurations") -public class TestDBConfigurations { - - private List dbTypesList; - - @XmlElement(name = "Type") - public List getDbTypesList() { - return dbTypesList; - } - - public void setDbTypesList(List dbTypesList) { - this.dbTypesList = dbTypesList; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDatabaseUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDatabaseUtils.java deleted file mode 100644 index f454f6f06..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/java/org/wso2/carbon/device/mgt/mobile/impl/dao/util/MobileDatabaseUtils.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2015, 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.impl.dao.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; -import org.wso2.carbon.device.mgt.mobile.impl.common.DBTypes; -import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfiguration; -import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfigurations; -import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import java.io.File; -import java.sql.*; - -/** - * This class provides the utility methods needed for DAO related test executions. - */ -public class MobileDatabaseUtils { - - private static final Log log = LogFactory.getLog(MobileDatabaseUtils.class); - public static final String TEST_RESOURCES_DB_CONFIG_FILE = - "src/test/resources/testdbconfig.xml"; - - public static void cleanupResources(Connection conn, Statement stmt, ResultSet rs) { - if (rs != null) { - try { - rs.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing result set", e); - } - } - if (stmt != null) { - try { - stmt.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing prepared statement", e); - } - } - if (conn != null) { - try { - conn.close(); - } catch (SQLException e) { - log.warn("Error occurred while closing database connection", e); - } - } - } - - public static TestDBConfiguration getTestDBConfiguration(DBTypes dbType) throws - MobileDeviceManagementDAOException, - DeviceManagementException { - File deviceMgtConfig = new File(TEST_RESOURCES_DB_CONFIG_FILE); - Document doc; - TestDBConfiguration testDBConfiguration = null; - TestDBConfigurations testDBConfigurations; - - doc = MobileDeviceManagementUtil.convertToDocument(deviceMgtConfig); - JAXBContext testDBContext; - - try { - testDBContext = JAXBContext.newInstance(TestDBConfigurations.class); - Unmarshaller unmarshaller = testDBContext.createUnmarshaller(); - testDBConfigurations = (TestDBConfigurations) unmarshaller.unmarshal(doc); - } catch (JAXBException e) { - throw new MobileDeviceManagementDAOException("Error parsing test db configurations", e); - } - - for (TestDBConfiguration testDBConfiguration1 : testDBConfigurations.getDbTypesList()) { - testDBConfiguration = testDBConfiguration1; - if (testDBConfiguration.getType().equals(dbType.toString())) { - break; - } - } - - return testDBConfiguration; - } - - public static void createH2DB(TestDBConfiguration testDBConf) throws Exception { - Connection conn = null; - Statement stmt = null; - try { - Class.forName(testDBConf.getDriverClassName()); - conn = DriverManager.getConnection(testDBConf.getConnectionURL()); - stmt = conn.createStatement(); - stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/h2.sql'"); - } finally { - cleanupResources(conn, stmt, null); - } - } -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml deleted file mode 100644 index 3fad2eceb..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-config.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - jdbc/MobileIOSDM_DS - - - - - jdbc/MobileAndroidDM_DS - - - - - jdbc/MobileWindowsDM_DS - - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-publisher-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-publisher-config.xml deleted file mode 100644 index 94fb50462..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-api-publisher-config.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - jdbc/MobileDM_DS - - - - - - - - enrollment - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-apis-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-apis-config.xml deleted file mode 100644 index 743fe6c24..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-apis-config.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - jdbc/MobileDM_DS - - - - - - - - enrollment - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-ds-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-ds-config.xml deleted file mode 100644 index 1f1b5ef14..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-ds-config.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - jdbc/MobileDM_DS - - - - - - - - enrollment - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-jndi-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-jndi-config.xml deleted file mode 100644 index 06dc33761..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-jndi-config.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - jdbc/MobileDM_DS - - - - - - - - enrollment - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-mgt-repo.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-mgt-repo.xml deleted file mode 100644 index 617742635..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/malformed-mobile-config-no-mgt-repo.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - jdbc/MobileDM_DS - - - - - - - - enrollment - admin - enrollment - 1.0.0 - http://localhost:9763/ - http,https - - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/schema/MobileDeviceManagementConfigSchema.xsd b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/schema/MobileDeviceManagementConfigSchema.xsd deleted file mode 100644 index ff6435e50..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/config/schema/MobileDeviceManagementConfigSchema.xsd +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/log4j.properties b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/log4j.properties deleted file mode 100644 index 675d63149..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/log4j.properties +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2015 WSO2, Inc. (http://wso2.com) -# -# 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. -# - -# -# This is the log4j configuration file used by WSO2 Carbon -# -# IMPORTANT : Please do not remove or change the names of any -# of the Appenders defined here. The layout pattern & log file -# can be changed using the WSO2 Carbon Management Console, and those -# settings will override the settings in this file. -# - -log4j.rootLogger=DEBUG, STD_OUT - -# Redirect log messages to console -log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender -log4j.appender.STD_OUT.Target=System.out -log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout -log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql deleted file mode 100644 index 78b5b7b8b..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql +++ /dev/null @@ -1,54 +0,0 @@ - --- ----------------------------------------------------- --- Table `AD_DEVICE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( - `DEVICE_ID` VARCHAR(45) NOT NULL , - `PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL , - `IMEI` VARCHAR(45) NULL DEFAULT NULL , - `IMSI` VARCHAR(45) NULL DEFAULT NULL , - `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL , - `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL , - `VENDOR` VARCHAR(45) NULL DEFAULT NULL , - `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, - `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, - `CHALLENGE` VARCHAR(45) NULL DEFAULT NULL, - `TOKEN` VARCHAR(500) NULL DEFAULT NULL, - `UNLOCK_TOKEN` VARCHAR(500) NULL DEFAULT NULL, - `SERIAL` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`DEVICE_ID`) ); - - --- ----------------------------------------------------- --- Table `AD_FEATURE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( - `ID` INT NOT NULL AUTO_INCREMENT , - `CODE` VARCHAR(45) NOT NULL, - `NAME` VARCHAR(100) NULL , - `DESCRIPTION` VARCHAR(200) NULL , - `DEVICE_TYPE` VARCHAR(50) NULL , - PRIMARY KEY (`ID`) ); - --- ----------------------------------------------------- --- Table `AD_OPERATION` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `AD_OPERATION` ( - `OPERATION_ID` INT NOT NULL AUTO_INCREMENT , - `FEATURE_CODE` VARCHAR(45) NOT NULL , - `CREATED_DATE` BIGINT NULL , - PRIMARY KEY (`OPERATION_ID`)); - - --- ----------------------------------------------------- --- Table `AD_FEATURE_PROPERTY` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `AD_FEATURE_PROPERTY` ( - `PROPERTY` VARCHAR(45) NOT NULL , - `FEATURE_ID` INT NOT NULL , - PRIMARY KEY (`PROPERTY`) , - CONSTRAINT `fk_AD_FEATURE_PROPERTY_AD_FEATURE1` - FOREIGN KEY (`FEATURE_ID` ) - REFERENCES `AD_FEATURE` (`ID` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testdbconfig.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testdbconfig.xml deleted file mode 100644 index eee04a324..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testdbconfig.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - jdbc:h2:mem:cdm-mobile-test-db;DB_CLOSE_DELAY=-1 - org.h2.Driver - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testng.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testng.xml deleted file mode 100644 index f73ab880b..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/testng.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/pom.xml deleted file mode 100644 index e19a3f965..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - device-mgt - org.wso2.carbon.devicemgt-plugins - 2.1.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.url.printer - 2.1.0-SNAPSHOT - bundle - WSO2 Carbon - Startup Handler That Prints MDM End-User Web-App URL - WSO2 Carbon - Startup Handler That Prints MDM End-User Web-App URL - http://wso2.org - - - - - org.apache.felix - maven-scr-plugin - - - org.apache.felix - maven-bundle-plugin - 1.4.0 - true - - - ${project.artifactId} - ${project.artifactId} - ${carbon.mobile.device.mgt.version} - Bundle Containing The Startup Handler That Prints MDM End-User Web-App URL - org.wso2.carbon.device.mgt.mobile.url.printer.internal - - org.osgi.framework, - org.osgi.service.component, - org.apache.commons.logging, - org.apache.axis2.*;version="${axis2.osgi.version.range}", - org.wso2.carbon.core, - org.wso2.carbon.utils.*, - - - !org.wso2.carbon.device.mgt.mobile.url.printer.internal, - org.wso2.carbon.device.mgt.mobile.url.printer, - - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.wso2.carbon - org.wso2.carbon.core - - - org.wso2.carbon - org.wso2.carbon.logging - - - org.wso2.carbon - org.wso2.carbon.utils - - - org.apache.axis2.wso2 - axis2 - - - - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java deleted file mode 100644 index 80aa39805..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015, 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.url.printer; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.core.ServerStartupObserver; -import org.wso2.carbon.device.mgt.mobile.url.printer.internal.URLPrinterDataHolder; -import org.wso2.carbon.utils.CarbonUtils; -import org.wso2.carbon.utils.ConfigurationContextService; -import org.wso2.carbon.utils.NetworkUtils; - -public class URLPrinterStartupHandler implements ServerStartupObserver { - - private static final Log log = LogFactory.getLog(URLPrinterStartupHandler.class); - - @Override - public void completingServerStartup() { - - } - - @Override - public void completedServerStartup() { - log.info("EMM Console URL : " + this.getEmmUrl()); - } - - private String getEmmUrl() { - // Hostname - String hostName = "localhost"; - try { - hostName = NetworkUtils.getMgtHostName(); - } catch (Exception ignored) { - } - // HTTPS port - String mgtConsoleTransport = CarbonUtils.getManagementTransport(); - ConfigurationContextService configContextService = - URLPrinterDataHolder.getInstance().getConfigurationContextService(); - int port = CarbonUtils.getTransportPort(configContextService, mgtConsoleTransport); - int httpsProxyPort = - CarbonUtils.getTransportProxyPort(configContextService.getServerConfigContext(), - mgtConsoleTransport); - if (httpsProxyPort > 0) { - port = httpsProxyPort; - } - return "https://" + hostName + ":" + port + "/emm"; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterDataHolder.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterDataHolder.java deleted file mode 100644 index 0dd8a459d..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterDataHolder.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2015, 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.url.printer.internal; - -import org.wso2.carbon.utils.ConfigurationContextService; - -public class URLPrinterDataHolder { - - private ConfigurationContextService configurationContextService; - private static URLPrinterDataHolder thisInstance = new URLPrinterDataHolder(); - - private URLPrinterDataHolder() {} - - public static URLPrinterDataHolder getInstance() { - return thisInstance; - } - - public ConfigurationContextService getConfigurationContextService() { - return configurationContextService; - } - - public void setConfigurationContextService(ConfigurationContextService configurationContextService) { - this.configurationContextService = configurationContextService; - } - -} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterStartupHandlerServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterStartupHandlerServiceComponent.java deleted file mode 100644 index 88a2b2dae..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/internal/URLPrinterStartupHandlerServiceComponent.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2015, 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.url.printer.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.core.ServerStartupObserver; -import org.wso2.carbon.device.mgt.mobile.url.printer.URLPrinterStartupHandler; -import org.wso2.carbon.utils.ConfigurationContextService; - -/** - * @scr.component name="org.wso2.carbon.device.mgt.mobile.url.printer.URLPrinterStartupHandlerServiceComponent" - * immediate="true" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - */ -public class URLPrinterStartupHandlerServiceComponent { - - private static final Log log = LogFactory.getLog(URLPrinterStartupHandlerServiceComponent.class); - - @SuppressWarnings("unused") - protected void activate(ComponentContext componentContext) { - try { - BundleContext bundleContext = componentContext.getBundleContext(); - /* Registering URL printer start-up handler */ - bundleContext.registerService(ServerStartupObserver.class, new URLPrinterStartupHandler(), null); - } catch (Throwable e) { - log.error("Error occurred while activating URL printer server start-up handler service component", e); - } - } - - @SuppressWarnings("unused") - protected void deactivate(ComponentContext componentContext) { - //do nothing - } - - protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { - if (log.isDebugEnabled()) { - log.debug("Setting ConfigurationContextService"); - } - URLPrinterDataHolder.getInstance().setConfigurationContextService(configurationContextService); - } - - protected void unsetConfigurationContextService(ConfigurationContextService configurationContextService) { - if (log.isDebugEnabled()) { - log.debug("Un-setting ConfigurationContextService"); - } - URLPrinterDataHolder.getInstance().setConfigurationContextService(null); - } - -} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java index 1eaad8ad4..80aa39805 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.url.printer/src/main/java/org/wso2/carbon/device/mgt/mobile/url/printer/URLPrinterStartupHandler.java @@ -37,7 +37,7 @@ public class URLPrinterStartupHandler implements ServerStartupObserver { @Override public void completedServerStartup() { - log.info("Device Management Console URL : " + this.getEmmUrl()); + log.info("EMM Console URL : " + this.getEmmUrl()); } private String getEmmUrl() { @@ -58,7 +58,7 @@ public class URLPrinterStartupHandler implements ServerStartupObserver { if (httpsProxyPort > 0) { port = httpsProxyPort; } - return "https://" + hostName + ":" + port + "/devicemgt"; + return "https://" + hostName + ":" + port + "/emm"; } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagementService.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidFeatureManager.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidPolicyMonitoringService.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidFeatureManagementDAOException.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidFeatureManagementDAOException.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidFeatureManagementDAOException.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidFeatureManagementDAOException.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidDeviceDAOImpl.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/impl/AndroidFeatureDAOImpl.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMResult.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMResult.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMResult.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMResult.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMService.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMService.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMService.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMService.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMUtil.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMUtil.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMUtil.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/gcm/GCMUtil.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginConstants.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginUtils.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginUtils.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginUtils.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidPluginUtils.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagementService.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsFeatureManager.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsFeatureManager.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsFeatureManager.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsFeatureManager.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsFeatureManagementDAOException.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsFeatureManagementDAOException.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsFeatureManagementDAOException.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsFeatureManagementDAOException.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginUtils.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginUtils.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginUtils.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginUtils.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsUtils.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsUtils.java similarity index 100% rename from components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsUtils.java rename to components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsUtils.java diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java index d8943def1..869904e81 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementDataHolder.java @@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.mobile.internal; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; +import org.wso2.carbon.device.mgt.mobile.impl.android.gcm.GCMService; import org.wso2.carbon.registry.core.service.RegistryService; /** @@ -27,6 +28,8 @@ import org.wso2.carbon.registry.core.service.RegistryService; public class MobileDeviceManagementDataHolder { private RegistryService registryService; + private DeviceManagementService androidDeviceManagementService; + private GCMService gcmService; private static MobileDeviceManagementDataHolder thisInstance = new MobileDeviceManagementDataHolder(); @@ -45,4 +48,20 @@ public class MobileDeviceManagementDataHolder { this.registryService = registryService; } + public DeviceManagementService getAndroidDeviceManagementService() { + return androidDeviceManagementService; + } + + public void setAndroidDeviceManagementService( + DeviceManagementService androidDeviceManagementService) { + this.androidDeviceManagementService = androidDeviceManagementService; + } + + public GCMService getGCMService() { + return gcmService; + } + + public void setGCMService(GCMService gcmService) { + this.gcmService = gcmService; + } } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java index e08771b3b..92404b67a 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java @@ -23,13 +23,20 @@ import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager; import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.dao.AbstractMobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagementService; +import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidPolicyMonitoringService; +import org.wso2.carbon.device.mgt.mobile.impl.android.gcm.GCMService; +import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagementService; +import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsPolicyMonitoringService; import org.wso2.carbon.ndatasource.core.DataSourceService; +import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; import org.wso2.carbon.registry.core.service.RegistryService; import java.util.Map; @@ -53,6 +60,10 @@ import java.util.Map; */ public class MobileDeviceManagementServiceComponent { + private ServiceRegistration androidServiceRegRef; + private ServiceRegistration windowsServiceRegRef; + private ServiceRegistration gcmServiceRegRef; + private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class); protected void activate(ComponentContext ctx) { @@ -89,6 +100,30 @@ public class MobileDeviceManagementServiceComponent { log.error("Exception occurred while initializing mobile device management database schema", e); } } + DeviceManagementService androidDeviceManagementService = new AndroidDeviceManagementService(); + GCMService gcmService = new GCMService(); + + androidServiceRegRef = + bundleContext.registerService(DeviceManagementService.class.getName(), + androidDeviceManagementService, null); + windowsServiceRegRef = + bundleContext.registerService(DeviceManagementService.class.getName(), + new WindowsDeviceManagementService(), null); + + gcmServiceRegRef = + bundleContext.registerService(GCMService.class.getName(), gcmService, null); + + + // Policy management service + + bundleContext.registerService(PolicyMonitoringService.class, + new AndroidPolicyMonitoringService(), null); + bundleContext.registerService(PolicyMonitoringService.class, + new WindowsPolicyMonitoringService(), null); + + MobileDeviceManagementDataHolder.getInstance().setAndroidDeviceManagementService( + androidDeviceManagementService); + MobileDeviceManagementDataHolder.getInstance().setGCMService(gcmService); if (log.isDebugEnabled()) { log.debug("Mobile Device Management Service Component has been successfully activated"); } @@ -102,6 +137,15 @@ public class MobileDeviceManagementServiceComponent { log.debug("De-activating Mobile Device Management Service Component"); } try { + if (androidServiceRegRef != null) { + androidServiceRegRef.unregister(); + } + if (windowsServiceRegRef != null) { + windowsServiceRegRef.unregister(); + } + if (gcmServiceRegRef != null) { + gcmServiceRegRef.unregister(); + } if (log.isDebugEnabled()) { log.debug( "Mobile Device Management Service Component has been successfully de-activated"); diff --git a/components/mobile-plugins/mobile-base-plugin/pom.xml b/components/mobile-plugins/mobile-base-plugin/pom.xml index b2912b562..94ae0d56a 100644 --- a/components/mobile-plugins/mobile-base-plugin/pom.xml +++ b/components/mobile-plugins/mobile-base-plugin/pom.xml @@ -34,8 +34,8 @@ org.wso2.carbon.device.mgt.mobile - org.wso2.carbon.device.mgt.mobile.api - org.wso2.carbon.device.mgt.mobile.ui + + org.wso2.carbon.device.mgt.mobile.url.printer diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 7c62f920b..898aded05 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -27,15 +27,14 @@ 4.0.0 - org.wso2.carbon.devicemgt-plugins mobile-plugins pom WSO2 Carbon - Mobile Plugins http://wso2.org - android-plugin - windows-plugin + + mobile-base-plugin diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/pom.xml b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/pom.xml similarity index 96% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/pom.xml rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/pom.xml index 6e07d9f97..26b491a65 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/pom.xml +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins - device-mgt-feature + mobile-base-plugin-feature 2.1.0-SNAPSHOT ../pom.xml @@ -38,7 +38,7 @@ org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.impl + org.wso2.carbon.device.mgt.mobile org.wso2.carbon.devicemgt @@ -104,7 +104,7 @@ org.wso2.carbon.device.mgt.mobile - ../../../features/etc/feature.properties + ../../../../features/etc/feature.properties org.wso2.carbon.p2.category.type:server diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/build.properties b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/build.properties similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/build.properties rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/build.properties diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mssql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mssql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mssql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mssql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgresql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgresql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgresql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgresql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mssql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mssql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mssql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mssql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgresql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgresql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgresql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgresql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mssql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mssql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mssql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mssql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf similarity index 100% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf rename to features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf diff --git a/components/device-mgt/pom.xml b/features/mobile-plugins-feature/mobile-base-plugin-feature/pom.xml similarity index 53% rename from components/device-mgt/pom.xml rename to features/mobile-plugins-feature/mobile-base-plugin-feature/pom.xml index 78a844e8d..8b0d196e5 100644 --- a/components/device-mgt/pom.xml +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/pom.xml @@ -21,41 +21,20 @@ org.wso2.carbon.devicemgt-plugins - carbon-device-mgt-plugins-parent + mobile-plugins-feature 2.1.0-SNAPSHOT - ../../pom.xml + ../pom.xml 4.0.0 - org.wso2.carbon.devicemgt-plugins - device-mgt + mobile-base-plugin-feature 2.1.0-SNAPSHOT pom - WSO2 Carbon - Mobile Device Management Component + WSO2 Carbon - Device Management Feature http://wso2.org - org.wso2.carbon.device.mgt.mobile.impl - org.wso2.carbon.device.mgt.mobile.url.printer + org.wso2.carbon.device.mgt.mobile.feature - - - - - org.apache.felix - maven-scr-plugin - 1.7.2 - - - generate-scr-scrdescriptor - - scr - - - - - - - diff --git a/features/device-mgt/pom.xml b/features/mobile-plugins-feature/pom.xml similarity index 89% rename from features/device-mgt/pom.xml rename to features/mobile-plugins-feature/pom.xml index bebd11623..852a9f91e 100644 --- a/features/device-mgt/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -27,15 +27,14 @@ 4.0.0 - org.wso2.carbon.devicemgt-plugins - device-mgt-feature + mobile-plugins-feature 2.1.0-SNAPSHOT pom WSO2 Carbon - Device Management Feature http://wso2.org - org.wso2.carbon.device.mgt.mobile.feature + mobile-base-plugin-feature diff --git a/pom.xml b/pom.xml index 0848df962..318c7e3df 100644 --- a/pom.xml +++ b/pom.xml @@ -37,10 +37,9 @@ - components/device-mgt - + components/mobile-plugins - features/device-mgt + features/mobile-plugins-feature