String dbPasswd = configuration.getString("backend.kiwi.password");
log.info("Initializing KiWiLoader for {}; user: {}, password: {}", dbCon, dbUser, String.format("%"+dbPasswd.length()+"s", "*"));
try {
KiWiConfiguration kiwi = new KiWiConfiguration("kiwiLoader", dbCon, dbUser, dbPasswd, getDialect(dbCon).newInstance());
store = new KiWiStore(kiwi);
repository = new SailRepository(store);
repository.initialize();
KiWiLoaderConfiguration loaderConfiguration = new KiWiLoaderConfiguration();
if(configuration.containsKey(LoaderOptions.CONTEXT)) {
loaderConfiguration.setContext(configuration.getString(LoaderOptions.CONTEXT));
}
loaderConfiguration.setDropIndexes(configuration.getBoolean("backend.kiwi.drop-indexes", false));
if(kiwi.getDialect() instanceof PostgreSQLDialect) {
log.info("- using PostgreSQL bulk loader ... ");
loaderConfiguration.setCommitBatchSize(100000);
handler = new KiWiPostgresHandler(store,loaderConfiguration);
} else if(kiwi.getDialect() instanceof MySQLDialect) {
log.info("- using MySQL bulk loader ... ");
loaderConfiguration.setCommitBatchSize(100000);
handler = new KiWiMySQLHandler(store,loaderConfiguration);
} else {
log.info("- using generic KiWi loader ... ");