Fixing the -Dsetup issue in mobile device database setup

revert-dabc3590
geethkokila 9 years ago
parent d085106158
commit c47ace254c

@ -90,9 +90,9 @@ public class MobileDeviceManagementDAOUtil {
* *
* @param dataSource Mobile data source * @param dataSource Mobile data source
*/ */
public static void setupMobileDeviceManagementSchema(DataSource dataSource) throws MobileDeviceMgtPluginException { public static void setupMobileDeviceManagementSchema(DataSource dataSource, String pluginType) throws MobileDeviceMgtPluginException {
MobileDeviceManagementSchemaInitializer initializer = MobileDeviceManagementSchemaInitializer initializer =
new MobileDeviceManagementSchemaInitializer(dataSource); new MobileDeviceManagementSchemaInitializer(dataSource, pluginType);
log.info("Initializing mobile device management repository database schema"); log.info("Initializing mobile device management repository database schema");
try { try {
initializer.createRegistryDatabase(); initializer.createRegistryDatabase();

@ -92,7 +92,7 @@ public class MobileDeviceManagementServiceComponent {
for (String pluginType : dsConfigMap.keySet()) { for (String pluginType : dsConfigMap.keySet()) {
MobileDeviceManagementDAOUtil MobileDeviceManagementDAOUtil
.setupMobileDeviceManagementSchema(MobileDeviceManagementDAOFactory.getDataSourceMap .setupMobileDeviceManagementSchema(MobileDeviceManagementDAOFactory.getDataSourceMap
().get(pluginType)); ().get(pluginType), pluginType);
} }
} catch (MobileDeviceMgtPluginException e) { } catch (MobileDeviceMgtPluginException 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);

@ -39,13 +39,23 @@ public final class MobileDeviceManagementSchemaInitializer extends DatabaseCreat
CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator
+ MobilePluginConstants.MOBILE_DB_SCRIPTS_FOLDER + + MobilePluginConstants.MOBILE_DB_SCRIPTS_FOLDER +
File.separator + "plugins" + File.separator; File.separator + "plugins" + File.separator;
private String pluginType;
public MobileDeviceManagementSchemaInitializer(DataSource dataSource) { public String getPluginType() {
return pluginType;
}
public void setPluginType(String pluginType) {
this.pluginType = pluginType;
}
public MobileDeviceManagementSchemaInitializer(DataSource dataSource, String pType) {
super(dataSource); super(dataSource);
this.pluginType = pType;
} }
protected String getDbScriptLocation(String databaseType) { protected String getDbScriptLocation(String databaseType) {
String scriptName = databaseType + ".sql"; String scriptName = databaseType + "_" + getPluginType() + ".sql";
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Loading database script from :" + scriptName); log.debug("Loading database script from :" + scriptName);
} }

Loading…
Cancel
Save