Search in sources :

Example 1 with HBaseExtractorState

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()));
}
Also used : HBaseExtractorState(org.apache.metron.dataloads.nonbulk.flatfile.HBaseExtractorState)

Example 2 with HBaseExtractorState

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;
}
Also used : EnrichmentConverter(org.apache.metron.enrichment.converter.EnrichmentConverter) HBaseExtractorState(org.apache.metron.dataloads.nonbulk.flatfile.HBaseExtractorState) HTableInterface(org.apache.hadoop.hbase.client.HTableInterface)

Aggregations

HBaseExtractorState (org.apache.metron.dataloads.nonbulk.flatfile.HBaseExtractorState)2 HTableInterface (org.apache.hadoop.hbase.client.HTableInterface)1 EnrichmentConverter (org.apache.metron.enrichment.converter.EnrichmentConverter)1