dlmarion commented on code in PR #5490: URL: https://github.com/apache/accumulo/pull/5490#discussion_r2056304223
########## core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java: ########## @@ -74,8 +79,65 @@ class RFileScanner extends ScannerOptions implements Scanner { + private static class RFileScannerIteratorEnvironmentBuilder + extends ClientIteratorEnvironment.Builder { + + public ClientIteratorEnvironment.Builder withEnvironment(ClientServiceEnvironmentImpl env) { + this.env = Optional.of(env); + return this; + } + + } + + private static class RFileScannerEnvironmentImpl extends ClientServiceEnvironmentImpl { + + private final Opts opts; + + public RFileScannerEnvironmentImpl(Opts opts) { + super(null); + this.opts = opts; + } + + @Override + public String getTableName(TableId tableId) throws TableNotFoundException { + Preconditions.checkArgument(tableId == TABLE_ID, "Expected " + TABLE_ID + " obtained" + + " from IteratorEnvironment.getTableId(), but got: " + tableId); + return TABLE_NAME; + } + + @Override + public <T> T instantiate(String className, Class<T> base) + throws ReflectiveOperationException, IOException { + return RFileScanner.class.getClassLoader().loadClass(className).asSubclass(base) + .getDeclaredConstructor().newInstance(); + } + + @Override + public <T> T instantiate(TableId tableId, String className, Class<T> base) + throws ReflectiveOperationException, IOException { + return instantiate(className, base); + } + + @Override + public Configuration getConfiguration() { + return new ConfigurationImpl(new ConfigurationCopy(DefaultConfiguration.getInstance())); + } + + @Override + public Configuration getConfiguration(TableId tableId) { + Preconditions.checkArgument(tableId == TABLE_ID, "Expected " + TABLE_ID + " obtained" + + " from IteratorEnvironment.getTableId(), but got: " + tableId); + ConfigurationCopy tableCC = new ConfigurationCopy(DefaultConfiguration.getInstance()); + opts.tableConfig.forEach(tableCC::set); + return new ConfigurationImpl(tableCC); + } Review Comment: Moved the configuration calculations to the constructor in 2d39e46. Had to guard against opts.tableConfig being null, which it is in RFileClientTest. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org