mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Fixing MobileDAOFactory initialization issues
This commit is contained in:
parent
decbcc83fc
commit
11d416cb82
@ -25,7 +25,6 @@ import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
|
||||
import org.wso2.carbon.device.mgt.mobile.DataSourceListener;
|
||||
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;
|
||||
@ -65,14 +64,6 @@ public class MobileDeviceManagementServiceComponent {
|
||||
try {
|
||||
BundleContext bundleContext = ctx.getBundleContext();
|
||||
|
||||
/* Initialize the datasource configuration */
|
||||
MobileDeviceConfigurationManager.getInstance().initConfig();
|
||||
MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance()
|
||||
.getMobileDeviceManagementConfig();
|
||||
MobileDataSourceConfig dsConfig =
|
||||
config.getMobileDeviceMgtRepository().getMobileDataSourceConfig();
|
||||
|
||||
MobileDeviceManagementDAOFactory.setDatSourceConfig(dsConfig);
|
||||
String setupOption = System.getProperty("setup");
|
||||
if (setupOption != null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
@ -131,12 +122,25 @@ public class MobileDeviceManagementServiceComponent {
|
||||
/* This is to avoid mobile device management component getting initialized before the underlying datasources
|
||||
are registered */
|
||||
try {
|
||||
MobileDeviceManagementDAOFactory.init();
|
||||
initConfigs();
|
||||
} catch (DeviceManagementException e) {
|
||||
log.error("Error occurred while initializing mobile device management repository datasource", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initConfigs() throws DeviceManagementException {
|
||||
/* Initialize the datasource configuration */
|
||||
MobileDeviceConfigurationManager.getInstance().initConfig();
|
||||
|
||||
MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance()
|
||||
.getMobileDeviceManagementConfig();
|
||||
MobileDataSourceConfig dsConfig =
|
||||
config.getMobileDeviceMgtRepository().getMobileDataSourceConfig();
|
||||
|
||||
MobileDeviceManagementDAOFactory.setDatSourceConfig(dsConfig);
|
||||
MobileDeviceManagementDAOFactory.init();
|
||||
}
|
||||
|
||||
protected void unsetDataSourceService(DataSourceService dataSourceService) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user