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 index 1e8d607423..b86ec09a41 100644 --- 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 @@ -63,7 +63,7 @@ public abstract class MobileDeviceManagementDAOFactory implements MobileDeviceMa * @param config Mobile data source configuration * @return data source resolved from the data source definition */ - protected static DataSource resolveDataSource(MobileDataSourceConfig config) { + public static DataSource resolveDataSource(MobileDataSourceConfig config) { DataSource dataSource = null; if (config == null) { throw new RuntimeException("Device Management Repository data source configuration " + @@ -111,7 +111,7 @@ public abstract class MobileDeviceManagementDAOFactory implements MobileDeviceMa private static void assertDataSourceInitialization() { if (!isInitialized) { - throw new DataSourceNotAvailableException("Mobile device management metadata repository datasource " + + throw new DataSourceNotAvailableException("Mobile device management metadata repository data source " + "is not initialized"); } } @@ -178,7 +178,7 @@ public abstract class MobileDeviceManagementDAOFactory implements MobileDeviceMa } } } catch (SQLException e) { - throw new MobileDeviceManagementDAOException("Error occurred while rollbacking the transaction", e); + throw new MobileDeviceManagementDAOException("Error occurred while rollback the transaction", e); } finally { closeConnection(); } 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/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java index 0ef9139c11..5ad45354ad 100644 --- 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/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java @@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.android.dao; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.dao.*; import org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl.AndroidDeviceDAOImpl; @@ -33,8 +34,9 @@ public class AndroidDAOFactory extends MobileDeviceManagementDAOFactory private static final Log log = LogFactory.getLog(AndroidDAOFactory.class); private static DataSource dataSource; - public static void init(MobileDataSourceConfig config) { - dataSource = resolveDataSource(config); + public static void init() { + dataSource = MobileDeviceManagementDAOFactory.getDataSource(DeviceManagementConstants.MobileDeviceTypes. + MOBILE_DEVICE_TYPE_ANDROID); } @Override diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/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 index c85e26a70d..612a93b7ae 100644 --- 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 @@ -24,7 +24,6 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.common.spi.DeviceManager; import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService; import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager; @@ -76,10 +75,9 @@ public class MobileDeviceManagementServiceComponent { Map dsConfigMap = config.getMobileDeviceMgtRepository().getMobileDataSourceConfigMap(); MobileDeviceManagementDAOFactory.setMobileDataSourceConfigMap(dsConfigMap); + MobileDeviceManagementDAOFactory.init(); - AndroidDAOFactory - .init(dsConfigMap.get(DeviceManagementConstants.MobileDeviceTypes. - MOBILE_DEVICE_TYPE_ANDROID)); + AndroidDAOFactory.init(); String setupOption = System.getProperty("setup"); if (setupOption != null) { @@ -89,8 +87,7 @@ public class MobileDeviceManagementServiceComponent { "to begin"); } try { - Map dataSourceMap = MobileDeviceManagementDAOFactory. - getDataSourceMap(); + Map dataSourceMap = MobileDeviceManagementDAOFactory.getDataSourceMap(); for (DataSource dataSource : dataSourceMap.values()) { MobileDeviceManagementDAOUtil .setupMobileDeviceManagementSchema(dataSource); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml index ebdbed3d22..c4c5c8f0e7 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/conf/mobile-config.xml @@ -20,11 +20,6 @@ - - - jdbc/MobileIOSDM_DS - - jdbc/MobileAndroidDM_DS