public JdbcWriter(JdbcWriterBuilder builder) { this.state = builder.destination.getProperties(); this.state.setProp(ConfigurationKeys.FORK_BRANCH_ID_KEY, Integer.toString(builder.branch)); String databaseTableKey = ForkOperatorUtils.getPropertyNameForBranch(JdbcPublisher.JDBC_PUBLISHER_DATABASE_NAME, builder.branches, builder.branch); this.databaseName = Preconditions.checkNotNull(this.state.getProp(databaseTableKey), "Staging table is missing with key " + databaseTableKey); String stagingTableKey = ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_STAGING_TABLE, builder.branches, builder.branch); this.tableName = Preconditions.checkNotNull(this.state.getProp(stagingTableKey), "Staging table is missing with key " + stagingTableKey); try { this.conn = createConnection(); this.commands = new JdbcWriterCommandsFactory().newInstance(this.state, this.conn); this.commands.setConnectionParameters(this.state.getProperties(), this.conn); } catch (SQLException e) { throw new RuntimeException(e); } }
public JdbcWriter(JdbcWriterBuilder builder) { this.state = builder.destination.getProperties(); this.state.setProp(ConfigurationKeys.FORK_BRANCH_ID_KEY, Integer.toString(builder.branch)); String databaseTableKey = ForkOperatorUtils.getPropertyNameForBranch(JdbcPublisher.JDBC_PUBLISHER_DATABASE_NAME, builder.branches, builder.branch); this.databaseName = Preconditions.checkNotNull(this.state.getProp(databaseTableKey), "Staging table is missing with key " + databaseTableKey); String stagingTableKey = ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_STAGING_TABLE, builder.branches, builder.branch); this.tableName = Preconditions.checkNotNull(this.state.getProp(stagingTableKey), "Staging table is missing with key " + stagingTableKey); try { this.conn = createConnection(); this.commands = new JdbcWriterCommandsFactory().newInstance(this.state, this.conn); this.commands.setConnectionParameters(this.state.getProperties(), this.conn); } catch (SQLException e) { throw new RuntimeException(e); } }