// NOTE: this configuration mirrored the "old" way of configuring
// local repositories, presumably it should be updated to
// mirror the new way?
if (repositoryType != null && repositoryType.equals("xml")) {
XMLRepositoryFactory factory =
XMLRepositoryFactory.getDefaultInstance();
repository = factory.createXMLRepository(null);
location = REPOSITORY_LOCATION_FACTORY.createDeviceRepositoryLocation(
Environment.getParameter(config, "file"));
} else {
// Default to JDBC.
JDBCRepositoryFactory factory =
JDBCRepositoryFactory.getDefaultInstance();
MCSDriverConfiguration driverConfiguration =
factory.createMCSDriverConfiguration();
driverConfiguration.setSource(
Environment.getParameter(config, "odbc-source"));
String vendor = Environment.getParameter(config, "odbc-vendor");
JDBCRepositoryType jdbcRepositoryType =
JDBCRepositoryType.getTypeForVendor(vendor);
if (jdbcRepositoryType != null) {
driverConfiguration.setDriverVendor(
jdbcRepositoryType.getVendor());
}
driverConfiguration.setHost(Environment.getParameter(config,
"odbc-host"));
String port = Environment.getParameter(config, "odbc-port");
if (port != null) {
driverConfiguration.setPort(Integer.parseInt(port));
}
DataSource dataSource = factory.createMCSDriverDataSource(
driverConfiguration);
JDBCRepositoryConfiguration configuration =
factory.createJDBCRepositoryConfiguration();
configuration.setDataSource(dataSource);
configuration.setUsername(Environment.getParameter(config,
"odbc-user"));
configuration.setPassword(Environment.getParameter(config,
"odbc-password"));
repository = factory.createJDBCRepository(configuration);
location = REPOSITORY_LOCATION_FACTORY.createDeviceRepositoryLocation(
Environment.getParameter(config, "project"));
}