Create plugin level database

revert-dabc3590
manoj 10 years ago
parent acb098f3ec
commit b796dee2e5

@ -18,10 +18,14 @@
package org.wso2.carbon.device.mgt.mobile.config; package org.wso2.carbon.device.mgt.mobile.config;
import org.wso2.carbon.device.mgt.mobile.common.PluginTypeEnum;
import org.wso2.carbon.device.mgt.mobile.config.datasource.DataSourceConfigAdapter;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Map;
/** /**
* Class for holding management repository data. * Class for holding management repository data.
@ -29,15 +33,19 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "ManagementRepository") @XmlRootElement(name = "ManagementRepository")
public class MobileDeviceManagementRepository { public class MobileDeviceManagementRepository {
private MobileDataSourceConfig mobileDataSourceConfig; private Map<String, MobileDataSourceConfig> mobileDataSourceConfigMap;
@XmlElement(name = "DataSourceConfiguration", nillable = false) public MobileDataSourceConfig getMobileDataSourceConfig(PluginTypeEnum type) {
public MobileDataSourceConfig getMobileDataSourceConfig() { return mobileDataSourceConfigMap.get(type.toString());
return mobileDataSourceConfig;
} }
public void setMobileDataSourceConfig(MobileDataSourceConfig mobileDataSourceConfig) { @XmlElement(name="DataSourceConfigurations")
this.mobileDataSourceConfig = mobileDataSourceConfig; @XmlJavaTypeAdapter(DataSourceConfigAdapter.class)
public Map<String, MobileDataSourceConfig> getMobileDataSourceConfigMap() {
return mobileDataSourceConfigMap;
} }
public void setMobileDataSourceConfigMap(Map<String, MobileDataSourceConfig> mobileDataSourceConfigMap) {
this.mobileDataSourceConfigMap = mobileDataSourceConfigMap;
}
} }

@ -18,6 +18,7 @@
package org.wso2.carbon.device.mgt.mobile.config.datasource; 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.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -27,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "DataSourceConfiguration") public class MobileDataSourceConfig { @XmlRootElement(name = "DataSourceConfiguration") public class MobileDataSourceConfig {
private JNDILookupDefinition jndiLookupDefinition; private JNDILookupDefinition jndiLookupDefinition;
private String type;
@XmlElement(name = "JndiLookupDefinition", nillable = true) @XmlElement(name = "JndiLookupDefinition", nillable = true)
public JNDILookupDefinition getJndiLookupDefinition() { public JNDILookupDefinition getJndiLookupDefinition() {
@ -37,4 +39,12 @@ import javax.xml.bind.annotation.XmlRootElement;
this.jndiLookupDefinition = jndiLookupDefinition; this.jndiLookupDefinition = jndiLookupDefinition;
} }
@XmlAttribute(name = "type")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
} }

@ -29,25 +29,34 @@ import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Factory class used to create MobileDeviceManagement related DAO objects. * Factory class used to create MobileDeviceManagement related DAO objects.
*/ */
public class MobileDeviceManagementDAOFactory { public class MobileDeviceManagementDAOFactory {
private static DataSource dataSource;
private static MobileDataSourceConfig mobileDataSourceConfig;
private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOFactory.class); private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOFactory.class);
private static Map<String,MobileDataSourceConfig> mobileDataSourceConfigMap;
private static Map<String,DataSource> dataSourceMap;
private String pluginProvider;
private DataSource dataSource;
public MobileDeviceManagementDAOFactory() { public MobileDeviceManagementDAOFactory(String pluginProvider) {
this.pluginProvider = pluginProvider;
this.dataSource = dataSourceMap.get(pluginProvider);
} }
public static void init() { public static void init() {
try { try {
dataSource = MobileDeviceManagementDAOFactory.resolveDataSource(mobileDataSourceConfig); DataSource dataSource;
for(String pluginType:mobileDataSourceConfigMap.keySet()){
dataSource = MobileDeviceManagementDAOFactory.resolveDataSource(mobileDataSourceConfigMap.get
(pluginType));
dataSourceMap.put(pluginType,dataSource);
}
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
log.error("Exception occurred while initializing the mobile datasource.",e); log.error("Exception occurred while initializing the mobile data source.",e);
} }
} }
@ -88,41 +97,47 @@ public class MobileDeviceManagementDAOFactory {
return dataSource; return dataSource;
} }
public static MobileDeviceDAO getMobileDeviceDAO() { public MobileDeviceDAO getMobileDeviceDAO() {
return new MobileDeviceDAOImpl(dataSource); return new MobileDeviceDAOImpl(dataSource);
} }
public static MobileOperationDAO getMobileOperationDAO() { public MobileOperationDAO getMobileOperationDAO() {
return new MobileOperationDAOImpl(dataSource); return new MobileOperationDAOImpl(dataSource);
} }
public static MobileOperationPropertyDAO getMobileOperationPropertyDAO() { public MobileOperationPropertyDAO getMobileOperationPropertyDAO() {
return new MobileOperationPropertyDAOImpl(dataSource); return new MobileOperationPropertyDAOImpl(dataSource);
} }
public static MobileDeviceOperationMappingDAO getMobileDeviceOperationDAO() { public MobileDeviceOperationMappingDAO getMobileDeviceOperationDAO() {
return new MobileDeviceOperationMappingDAOImpl(dataSource); return new MobileDeviceOperationMappingDAOImpl(dataSource);
} }
public static MobileFeatureDAO getFeatureDAO() { public MobileFeatureDAO getFeatureDAO() {
return new MobileFeatureDAOImpl(dataSource); return new MobileFeatureDAOImpl(dataSource);
} }
public static MobileFeaturePropertyDAO getFeaturePropertyDAO() { public MobileFeaturePropertyDAO getFeaturePropertyDAO() {
return new MobileFeaturePropertyDAOImpl(dataSource); return new MobileFeaturePropertyDAOImpl(dataSource);
} }
public static MobileDataSourceConfig getMobileDeviceManagementConfig() { public MobileDataSourceConfig getMobileDeviceManagementConfig(String pluginType) {
return mobileDataSourceConfig; return mobileDataSourceConfigMap.get(pluginType);
} }
public static void setMobileDataSourceConfig( public static Map<String, MobileDataSourceConfig> getMobileDataSourceConfigMap() {
MobileDataSourceConfig mobileDataSourceConfig) { return mobileDataSourceConfigMap;
MobileDeviceManagementDAOFactory.mobileDataSourceConfig =
mobileDataSourceConfig;
} }
public static DataSource getDataSource() { public static void setMobileDataSourceConfigMap(Map<String, MobileDataSourceConfig> mobileDataSourceConfigMap) {
return dataSource; MobileDeviceManagementDAOFactory.mobileDataSourceConfigMap = mobileDataSourceConfigMap;
}
public DataSource getDataSource(String type) {
return dataSourceMap.get(type);
}
public static Map<String, DataSource> getDataSourceMap() {
return dataSourceMap;
} }
} }

@ -20,12 +20,12 @@ package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager; import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import org.wso2.carbon.device.mgt.common.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -36,6 +36,12 @@ import java.util.List;
public class AndroidDeviceManagerService implements DeviceManager { public class AndroidDeviceManagerService implements DeviceManager {
private static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class); private static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class);
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
public AndroidDeviceManagerService() {
mobileDeviceManagementDAOFactory = new MobileDeviceManagementDAOFactory(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
}
@Override @Override
public String getProviderType() { public String getProviderType() {
@ -55,7 +61,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier()); log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier());
} }
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice( status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
mobileDevice); mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while enrolling the Android device : " + String msg = "Error while enrolling the Android device : " +
@ -74,7 +80,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Modifying the Android device enrollment data"); log.debug("Modifying the Android device enrollment data");
} }
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO() status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.updateMobileDevice(mobileDevice); .updateMobileDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while updating the enrollment of the Android device : " + String msg = "Error while updating the enrollment of the Android device : " +
@ -92,7 +98,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Dis-enrolling Android device : " + deviceId); log.debug("Dis-enrolling Android device : " + deviceId);
} }
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO() status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.deleteMobileDevice(deviceId.getId()); .deleteMobileDevice(deviceId.getId());
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while removing the Android device : " + deviceId.getId(); String msg = "Error while removing the Android device : " + deviceId.getId();
@ -110,7 +116,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
log.debug("Checking the enrollment of Android device : " + deviceId.getId()); log.debug("Checking the enrollment of Android device : " + deviceId.getId());
} }
MobileDevice mobileDevice = MobileDevice mobileDevice =
MobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice( mobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice(
deviceId.getId()); deviceId.getId());
if (mobileDevice != null) { if (mobileDevice != null) {
isEnrolled = true; isEnrolled = true;
@ -142,7 +148,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting the details of Android device : " + deviceId.getId()); log.debug("Getting the details of Android device : " + deviceId.getId());
} }
MobileDevice mobileDevice = MobileDeviceManagementDAOFactory.getMobileDeviceDAO(). MobileDevice mobileDevice = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().
getMobileDevice(deviceId.getId()); getMobileDevice(deviceId.getId());
device = MobileDeviceManagementUtil.convertToDevice(mobileDevice); device = MobileDeviceManagementUtil.convertToDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
@ -167,7 +173,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("updating the details of Android device : " + device.getDeviceIdentifier()); log.debug("updating the details of Android device : " + device.getDeviceIdentifier());
} }
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO() status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.updateMobileDevice(mobileDevice); .updateMobileDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while updating the Android device : " + device.getDeviceIdentifier(); String msg = "Error while updating the Android device : " + device.getDeviceIdentifier();
@ -185,7 +191,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
log.debug("Fetching the details of all Android devices"); log.debug("Fetching the details of all Android devices");
} }
List<MobileDevice> mobileDevices = List<MobileDevice> mobileDevices =
MobileDeviceManagementDAOFactory.getMobileDeviceDAO(). mobileDeviceManagementDAOFactory.getMobileDeviceDAO().
getAllMobileDevices(); getAllMobileDevices();
if (mobileDevices != null) { if (mobileDevices != null) {
devices = new ArrayList<Device>(); devices = new ArrayList<Device>();

@ -35,12 +35,18 @@ import java.util.List;
public class IOSDeviceManagerService implements DeviceManager { public class IOSDeviceManagerService implements DeviceManager {
private static final Log log = LogFactory.getLog(IOSDeviceManagerService.class); private static final Log log = LogFactory.getLog(IOSDeviceManagerService.class);
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
@Override @Override
public String getProviderType() { public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS; return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS;
} }
public IOSDeviceManagerService() {
mobileDeviceManagementDAOFactory = new MobileDeviceManagementDAOFactory(DeviceManagementConstants
.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS);
}
@Override @Override
public FeatureManager getFeatureManager() { public FeatureManager getFeatureManager() {
return null; return null;
@ -51,7 +57,7 @@ public class IOSDeviceManagerService implements DeviceManager {
boolean status; boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try { try {
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice( status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
mobileDevice); mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while enrolling the iOS device : " + String msg = "Error while enrolling the iOS device : " +
@ -70,7 +76,7 @@ public class IOSDeviceManagerService implements DeviceManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Modifying the iOS device enrollment data"); log.debug("Modifying the iOS device enrollment data");
} }
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO() status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.updateMobileDevice(mobileDevice); .updateMobileDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while updating the enrollment of the iOS device : " + String msg = "Error while updating the enrollment of the iOS device : " +
@ -94,7 +100,7 @@ public class IOSDeviceManagerService implements DeviceManager {
log.debug("Checking the enrollment of iOS device : " + deviceId.getId()); log.debug("Checking the enrollment of iOS device : " + deviceId.getId());
} }
MobileDevice mobileDevice = MobileDevice mobileDevice =
MobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice( mobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice(
deviceId.getId()); deviceId.getId());
if (mobileDevice != null) { if (mobileDevice != null) {
isEnrolled = true; isEnrolled = true;
@ -131,7 +137,7 @@ public class IOSDeviceManagerService implements DeviceManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Getting the details of iOS device : " + deviceId.getId()); log.debug("Getting the details of iOS device : " + deviceId.getId());
} }
MobileDevice mobileDevice = MobileDeviceManagementDAOFactory.getMobileDeviceDAO(). MobileDevice mobileDevice = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().
getMobileDevice(deviceId.getId()); getMobileDevice(deviceId.getId());
device = MobileDeviceManagementUtil.convertToDevice(mobileDevice); device = MobileDeviceManagementUtil.convertToDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {

@ -35,6 +35,12 @@ import java.util.List;
public class WindowsDeviceManagerService implements DeviceManager { public class WindowsDeviceManagerService implements DeviceManager {
private static final Log log = LogFactory.getLog(WindowsDeviceManagerService.class); private static final Log log = LogFactory.getLog(WindowsDeviceManagerService.class);
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
public WindowsDeviceManagerService() {
mobileDeviceManagementDAOFactory = new MobileDeviceManagementDAOFactory(DeviceManagementConstants
.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
}
@Override @Override
public String getProviderType() { public String getProviderType() {
@ -97,7 +103,7 @@ public class WindowsDeviceManagerService implements DeviceManager {
boolean status; boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try { try {
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice( status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
mobileDevice); mobileDevice);
} catch (MobileDeviceManagementDAOException e) { } catch (MobileDeviceManagementDAOException e) {
String msg = "Error while enrolling the Windows device : " + String msg = "Error while enrolling the Windows device : " +

@ -39,6 +39,7 @@ import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* BundleActivator of MobileDeviceManagement component. * BundleActivator of MobileDeviceManagement component.
@ -64,14 +65,14 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
} }
bundleContext.addBundleListener(this); bundleContext.addBundleListener(this);
/* Initialize the datasource configuration */ /* Initialize the data source configuration */
MobileDeviceConfigurationManager.getInstance().initConfig(); MobileDeviceConfigurationManager.getInstance().initConfig();
MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance()
.getMobileDeviceManagementConfig(); .getMobileDeviceManagementConfig();
MobileDataSourceConfig dsConfig = Map<String, MobileDataSourceConfig> mobileDataSourceConfigMap =
config.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); config.getMobileDeviceMgtRepository().getMobileDataSourceConfigMap();
MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig); MobileDeviceManagementDAOFactory.setMobileDataSourceConfigMap(mobileDataSourceConfigMap);
androidServiceRegRef = androidServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),

@ -39,7 +39,9 @@ import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil; import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import javax.sql.DataSource;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @scr.component name="org.wso2.carbon.device.mgt.mobile.impl.internal.MobileDeviceManagementServiceComponent" * @scr.component name="org.wso2.carbon.device.mgt.mobile.impl.internal.MobileDeviceManagementServiceComponent"
@ -71,14 +73,14 @@ public class MobileDeviceManagementServiceComponent {
try { try {
BundleContext bundleContext = ctx.getBundleContext(); BundleContext bundleContext = ctx.getBundleContext();
/* Initialize the datasource configuration */ /* Initialize the data source configuration */
MobileDeviceConfigurationManager.getInstance().initConfig(); MobileDeviceConfigurationManager.getInstance().initConfig();
MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance()
.getMobileDeviceManagementConfig(); .getMobileDeviceManagementConfig();
MobileDataSourceConfig dsConfig = Map<String,MobileDataSourceConfig> dsConfigMap =
config.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); config.getMobileDeviceMgtRepository().getMobileDataSourceConfigMap();
MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig); MobileDeviceManagementDAOFactory.setMobileDataSourceConfigMap(dsConfigMap);
MobileDeviceManagementDAOFactory.init(); MobileDeviceManagementDAOFactory.init();
String setupOption = System.getProperty("setup"); String setupOption = System.getProperty("setup");
if (setupOption != null) { if (setupOption != null) {
@ -88,8 +90,11 @@ public class MobileDeviceManagementServiceComponent {
"to begin"); "to begin");
} }
try { try {
MobileDeviceManagementDAOUtil.setupMobileDeviceManagementSchema( Map<String,DataSource> dataSourceMap = MobileDeviceManagementDAOFactory.getDataSourceMap();
MobileDeviceManagementDAOFactory.getDataSource()); for(DataSource dataSource:dataSourceMap.values()) {
MobileDeviceManagementDAOUtil
.setupMobileDeviceManagementSchema(dataSource);
}
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
log.error("Exception occurred while initializing mobile device management database schema", e); log.error("Exception occurred while initializing mobile device management database schema", e);
} }

@ -19,13 +19,25 @@
<MobileDeviceMgtConfiguration> <MobileDeviceMgtConfiguration>
<ManagementRepository> <ManagementRepository>
<DataSourceConfiguration>
<DataSourceConfigurations>
<DataSourceConfiguration type="ios">
<JndiLookupDefinition>
<Name>jdbc/MobileIOSDM_DS</Name>
</JndiLookupDefinition>
</DataSourceConfiguration>
<DataSourceConfiguration type="android">
<JndiLookupDefinition> <JndiLookupDefinition>
<Name>jdbc/MobileDM_DS</Name> <Name>jdbc/MobileAndroidDM_DS</Name>
</JndiLookupDefinition> </JndiLookupDefinition>
</DataSourceConfiguration> </DataSourceConfiguration>
<DataSourceConfiguration type="windows">
<JndiLookupDefinition>
<Name>jdbc/MobileWindowsDM_DS</Name>
</JndiLookupDefinition>
</DataSourceConfiguration>
</DataSourceConfigurations>
</ManagementRepository> </ManagementRepository>
<APIPublisher> <APIPublisher>
<APIs> <APIs>
<API> <API>

Loading…
Cancel
Save