|
|
|
@ -45,7 +45,7 @@ public class MobileDeviceManagementDAOUtil {
|
|
|
|
|
* @param config Mobile data source configuration
|
|
|
|
|
* @return data source resolved from the data source definition
|
|
|
|
|
*/
|
|
|
|
|
public static DataSource resolveDataSource(MobileDataSourceConfig config) {
|
|
|
|
|
public static DataSource resolveDataSource(MobileDataSourceConfig config) throws DeviceManagementException {
|
|
|
|
|
DataSource dataSource = null;
|
|
|
|
|
if (config == null) {
|
|
|
|
|
throw new RuntimeException("Device Management Repository data source configuration " +
|
|
|
|
@ -64,25 +64,10 @@ public class MobileDeviceManagementDAOUtil {
|
|
|
|
|
for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) {
|
|
|
|
|
jndiProperties.put(prop.getName(), prop.getValue());
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
dataSource = MobileDeviceManagementDAOUtil.lookupDataSource(
|
|
|
|
|
jndiConfig.getJndiName(), jndiProperties);
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Error in looking up data source: " + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
log.error(e);
|
|
|
|
|
}
|
|
|
|
|
dataSource =
|
|
|
|
|
MobileDeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
dataSource = MobileDeviceManagementDAOUtil.lookupDataSource(
|
|
|
|
|
jndiConfig.getJndiName(), null);
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
log.debug("Error in looking up data source: " + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
log.error(e);
|
|
|
|
|
}
|
|
|
|
|
dataSource = MobileDeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return dataSource;
|
|
|
|
@ -96,10 +81,11 @@ public class MobileDeviceManagementDAOUtil {
|
|
|
|
|
return (DataSource) InitialContext.doLookup(dataSourceName);
|
|
|
|
|
}
|
|
|
|
|
final InitialContext context = new InitialContext(jndiProperties);
|
|
|
|
|
return (DataSource) context.doLookup(dataSourceName);
|
|
|
|
|
return (DataSource) context.lookup(dataSourceName);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new DeviceManagementException(
|
|
|
|
|
"Error in looking up data source: " + e.getMessage(), e);
|
|
|
|
|
String msg = "Error in looking up data source: " + e.getMessage();
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
throw new DeviceManagementException(msg, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -143,9 +129,7 @@ public class MobileDeviceManagementDAOUtil {
|
|
|
|
|
try {
|
|
|
|
|
MobileDeviceManagementDAOUtil.setupMobileDeviceManagementSchema(dataSource);
|
|
|
|
|
} 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -163,8 +147,7 @@ public class MobileDeviceManagementDAOUtil {
|
|
|
|
|
try {
|
|
|
|
|
initializer.createRegistryDatabase();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new DeviceManagementException(
|
|
|
|
|
"Error occurred while initializing Mobile Device Management " +
|
|
|
|
|
throw new DeviceManagementException("Error occurred while initializing Mobile Device Management " +
|
|
|
|
|
"database schema", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|