hTable.put(p); } catch (IOException e) { if (debug) {
@Override public void put(Put put) throws IOException { table.put(put); }
@Override public void writeColumns(HTableInterface htable, String columnFamily, Object rowKey, Map<String, Attribute> columns, Map<String, Object> values, Object columnFamilyObj) throws IOException { Put p = preparePut(columnFamily, rowKey, columns, values); htable.put(p); }
@Override public void writeColumn(HTableInterface htable, String columnFamily, Object rowKey, Attribute column, Object columnObj) throws IOException { Put p = new Put(HBaseUtils.getBytes(rowKey)); p.add(Bytes.toBytes(columnFamily), Bytes.toBytes(((AbstractAttribute) column).getJPAColumnName()), Bytes.toBytes(columnObj.toString())); htable.put(p); }
public void save(String user, String type, String userSettings) throws IOException { byte[] rowKey = Bytes.toBytes(user); Put put = new Put(rowKey); put.addColumn(cf, Bytes.toBytes(type), Bytes.toBytes(userSettings)); getTableInterface().put(put); }
@Override public Map<Document, Optional<String>> batchUpdate(Map<Document, Optional<String>> updates) throws IOException { List<Put> puts = new ArrayList<>(); for (Map.Entry<Document, Optional<String>> updateEntry : updates.entrySet()) { Document update = updateEntry.getKey(); Put put = buildPut(update); puts.add(put); } getTableInterface().put(puts); return updates; }
public void persistTracker(HTableInterface accessTrackerTable, String columnFamily, PersistentAccessTracker.AccessTrackerKey key, AccessTracker underlyingTracker) throws IOException { Put put = new Put(key.toRowKey()); put.add(Bytes.toBytes(columnFamily), COLUMN, serializeTracker(underlyingTracker)); accessTrackerTable.put(put); }
@Override public void writeColumns(HTableInterface htable, Object rowKey, Map<String, Object> columns, String columnFamilyName) throws IOException { Put p = new Put(HBaseUtils.getBytes(rowKey)); boolean isPresent = false; for (String columnName : columns.keySet()) { p.add(columnFamilyName.getBytes(), Bytes.toBytes(columnName), HBaseUtils.getBytes(columns.get(columnName))); isPresent = true; } if (isPresent) { htable.put(p); } }
@Override public synchronized Document update(Document update, Optional<String> index) throws IOException { Put put = buildPut(update); getTableInterface().put(put); return update; }
@Override public void write(String sourceType, WriterConfiguration configurations, Tuple tuple, JSONObject message) throws Exception { Put put = new Put(getKey(tuple, message)); Map<String, byte[]> values = getValues(tuple, message); for(String column: values.keySet()) { String[] columnParts = column.split(":"); long timestamp = getTimestamp(tuple, message); if (timestamp > -1) { put.addColumn(Bytes.toBytes(columnParts[0]), Bytes.toBytes(columnParts[1]), timestamp, values.get(column)); } else { put.addColumn(Bytes.toBytes(columnParts[0]), Bytes.toBytes(columnParts[1]), values.get(column)); } } table.put(put); }
hTable.put(p);
@Override public void persistRows(Map<HTableInterface, List<HBaseDataWrapper>> rows) throws IOException { List<Put> dataSet = new ArrayList<Put>(rows.size()); for (HTableInterface hTable : rows.keySet()) { List<HBaseDataWrapper> row = rows.get(hTable); for (HBaseDataWrapper data : row) { dataSet.add(preparePut(data.getColumnFamily(), data.getRowKey(), data.getColumns(), data.getValues())); } hTable.put(dataSet); dataSet.clear(); } }
@Override protected void putResourceImpl(String resPath, InputStream content, long ts) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); IOUtils.copy(content, bout); bout.close(); HTableInterface table = getConnection().getTable(getAllInOneTableName()); try { byte[] row = Bytes.toBytes(resPath); Put put = buildPut(resPath, ts, row, bout.toByteArray(), table); table.put(put); table.flushCommits(); } finally { IOUtils.closeQuietly(table); } }
public void load(HTableInterface table, String cf, Iterable<LookupKV<EnrichmentKey, EnrichmentValue>> results) throws IOException { for(LookupKV<EnrichmentKey, EnrichmentValue> result : results) { Put put = converter.toPut(cf, result.getKey(), result.getValue()); table.put(put); } } }
byte[] cell = randomBytes(); put.add(CF, QN, cell); table.put(put); nBytes += cell.length; dot(i, N_ROWS);
htable.put(p);
@Override public void writeRelations(HTableInterface htable, Object rowKey, boolean containsEmbeddedObjectsOnly, List<RelationHolder> relations, String columnFamilyName) throws IOException { Put p = new Put(HBaseUtils.getBytes(rowKey)); boolean isPresent = false; for (RelationHolder r : relations) { if (r != null) { if (containsEmbeddedObjectsOnly) { p.add(Bytes.toBytes(r.getRelationName()), Bytes.toBytes(r.getRelationName()), PropertyAccessorHelper.getBytes(r.getRelationValue())); isPresent = true; } else { p.add(columnFamilyName.getBytes(), Bytes.toBytes(r.getRelationName()), System.currentTimeMillis(), PropertyAccessorHelper.getBytes(r.getRelationValue())); isPresent = true; } } } if (isPresent) { htable.put(p); } }
@Override protected void extract(HBaseExtractorState state, String line) throws IOException { HBaseExtractorState es = state; es.getTable().put(toPut(line, es.getExtractor(), state.getCf(), es.getConverter())); }
Put p = converter.toPut(columnFamily, kv.getKey(), kv.getValue()); HTableInterface table = getTable(hbaseTable); table.put(p); LOG.info("Found Threat Intel: {} => ", kv.getKey(), kv.getValue());
table.put(puts); } catch (Exception e) { response.addAllErrors(e, tuples);