use of ch.ehi.ili2db.fromili.IliFromDb in project ili2db by claeis.
the class Ili2db method setupIli2cPathmap.
private static void setupIli2cPathmap(Config config, String appHome, String xtffile, java.sql.Connection conn) throws Ili2dbException {
config.setValue(ch.interlis.ili2c.gui.UserSettings.ILIDIRS, config.getModeldir());
java.util.HashMap pathMap = new java.util.HashMap();
if (xtffile != null) {
pathMap.put(Ili2db.XTF_DIR, new java.io.File(xtffile).getAbsoluteFile().getParent());
} else {
pathMap.put(Ili2db.XTF_DIR, null);
}
pathMap.put(Ili2db.JAR_DIR, appHome);
config.setTransientObject(ch.interlis.ili2c.gui.UserSettings.ILIDIRS_PATHMAP, pathMap);
// if ilimodels exists in db
if (conn != null) {
IliFiles iliFiles = null;
String url = null;
try {
url = conn.getMetaData().getURL();
iliFiles = TransferFromIli.readIliFiles(conn, config.getDbschema());
} catch (SQLException e) {
throw new Ili2dbException(e);
}
if (iliFiles != null) {
String dbSchema = config.getDbschema();
if (dbSchema != null) {
url = url + "/" + dbSchema;
}
pathMap.put(Ili2db.ILI_FROM_DB, url);
config.setTransientValue(ch.interlis.ili2c.gui.UserSettings.TEMP_REPOS_URI, url);
config.setTransientObject(ch.interlis.ili2c.gui.UserSettings.TEMP_REPOS_ILIFILES, iliFiles);
config.setTransientObject(ch.interlis.ili2c.gui.UserSettings.CUSTOM_ILI_RESOLVER, new IliFromDb(url, conn, dbSchema));
}
}
}
Aggregations