use of org.apache.metron.dataloads.nonbulk.flatfile.HBaseExtractorState in project metron by apache.
the class LocalImporter method extract.
@Override
protected void extract(HBaseExtractorState state, String line) throws IOException {
HBaseExtractorState es = state;
es.getTable().put(toPut(line, es.getExtractor(), state.getCf(), es.getConverter()));
}
use of org.apache.metron.dataloads.nonbulk.flatfile.HBaseExtractorState in project metron by apache.
the class LocalImporter method createState.
@Override
protected ThreadLocal<HBaseExtractorState> createState(EnumMap<LoadOptions, Optional<Object>> config, Configuration hadoopConfig, final ExtractorHandler handler) {
ThreadLocal<HBaseExtractorState> state = new ThreadLocal<HBaseExtractorState>() {
@Override
protected HBaseExtractorState initialValue() {
try {
String cf = (String) config.get(LoadOptions.HBASE_CF).get();
HTableInterface table = provider.retrieve().getTable(hadoopConfig, (String) config.get(LoadOptions.HBASE_TABLE).get());
return new HBaseExtractorState(table, cf, handler.getExtractor(), new EnrichmentConverter(), hadoopConfig);
} catch (IOException e1) {
throw new IllegalStateException("Unable to get table: " + e1);
}
}
};
return state;
}
Aggregations