public InternalLog buildObject(byte[] row, long timestamp, Map<String, byte[]> allQualifierValues) { InternalLog alertDetail = new InternalLog(); String myRow = EagleBase64Wrapper.encodeByteArray2URLSafeString(row); alertDetail.setEncodedRowkey(myRow); alertDetail.setPrefix(schema.getPrefix()); alertDetail.setSearchTags(searchTags); alertDetail.setTimestamp(timestamp); Map<String, byte[]> logQualifierValues = new HashMap<String, byte[]>(); Map<String, String> logTags = new HashMap<String, String>(); for (Map.Entry<String, byte[]> entry : allQualifierValues.entrySet()) { if (schema.isTag(entry.getKey())) { if (entry.getValue() != null) { logTags.put(entry.getKey(), new String(entry.getValue())); } } else { logQualifierValues.put(entry.getKey(),entry.getValue()); } } alertDetail.setQualifierValues(logQualifierValues); alertDetail.setTags(logTags); return alertDetail; } }
private InternalLog buildLog(Result result) { final InternalLog log = new InternalLog(); final byte[] rowkey = result.getRow(); log.setEncodedRowkey(EagleBase64Wrapper.encodeByteArray2URLSafeString(rowkey)); long timestamp = ByteUtil.bytesToLong(rowkey, 4); timestamp = Long.MAX_VALUE - timestamp; log.setTimestamp(timestamp); Map<String, byte[]> qualifierValues = new HashMap<String, byte[]>(); log.setQualifierValues(qualifierValues); NavigableMap<byte[], byte[]> map = result.getFamilyMap(this.columnFamily.getBytes()); if(map == null){ throw new NoSuchRowException(EagleBase64Wrapper.encodeByteArray2URLSafeString(rowkey)); } for(Map.Entry<byte[], byte[]> entry : map.entrySet()){ byte[] qualifier = entry.getKey(); byte[] value = entry.getValue(); qualifierValues.put(new String(qualifier), value); } return log; }
public InternalLog buildObject(byte[] row, long timestamp, Map<String, byte[]> allQualifierValues) { InternalLog alertDetail = new InternalLog(); String myRow = EagleBase64Wrapper.encodeByteArray2URLSafeString(row); alertDetail.setEncodedRowkey(myRow); alertDetail.setPrefix(schema.getPrefix()); alertDetail.setSearchTags(searchTags); alertDetail.setTimestamp(timestamp); Map<String, byte[]> logQualifierValues = new HashMap<String, byte[]>(); Map<String, String> logTags = new HashMap<String, String>(); for (Map.Entry<String, byte[]> entry : allQualifierValues.entrySet()) { if (schema.isTag(entry.getKey())) { if (entry.getValue() != null) { logTags.put(entry.getKey(), new String(entry.getValue())); } } else { logQualifierValues.put(entry.getKey(), entry.getValue()); } } alertDetail.setQualifierValues(logQualifierValues); alertDetail.setTags(logTags); return alertDetail; } }
private InternalLog buildLog(Result result) { final InternalLog log = new InternalLog(); final byte[] rowkey = result.getRow(); log.setEncodedRowkey(EagleBase64Wrapper.encodeByteArray2URLSafeString(rowkey)); long timestamp = ByteUtil.bytesToLong(rowkey, 4); timestamp = Long.MAX_VALUE - timestamp; log.setTimestamp(timestamp); Map<String, byte[]> qualifierValues = new HashMap<String, byte[]>(); log.setQualifierValues(qualifierValues); NavigableMap<byte[], byte[]> map = result.getFamilyMap(this.columnFamily.getBytes()); if (map == null) { throw new NoSuchRowException(EagleBase64Wrapper.encodeByteArray2URLSafeString(rowkey)); } for (Map.Entry<byte[], byte[]> entry : map.entrySet()) { byte[] qualifier = entry.getKey(); byte[] value = entry.getValue(); qualifierValues.put(new String(qualifier), value); } return log; }
log.setEncodedRowkey(myRow); log.setPrefix(ed.getPrefix()); log.setTimestamp(timestamp);
log.setEncodedRowkey(myRow); log.setPrefix(ed.getPrefix()); log.setTimestamp(timestamp);
public List<String> write(List<? extends TaggedLogAPIEntity> entities) throws IOException { HBaseLogWriter writer = new HBaseLogWriter(table, columnFamily); List<String> rowkeys = new ArrayList<String>(); try { writer.open(); for (TaggedLogAPIEntity entity : entities) { InternalLog log = new InternalLog(); Map<String, String> inputTags = entity.getTags(); Map<String, String> tags = new TreeMap<String, String>(); for (Map.Entry<String, String> entry : inputTags.entrySet()) { tags.put(entry.getKey(), entry.getValue()); } log.setTags(tags); log.setTimestamp(entity.getTimestamp()); log.setPrefix(entity.getPrefix()); log.setQualifierValues(mapper.createQualifierValues(entity)); byte[] rowkey = writer.write(log); rowkeys.add(EagleBase64Wrapper.encodeByteArray2URLSafeString(rowkey)); } } catch (IOException ioe) { LOG.error("Fail writing tagged log", ioe); throw ioe; } finally { writer.close(); } return rowkeys; }
public List<String> write(List<? extends TaggedLogAPIEntity> entities) throws IOException{ HBaseLogWriter writer = new HBaseLogWriter(table, columnFamily); List<String> rowkeys = new ArrayList<String>(); try{ writer.open(); for(TaggedLogAPIEntity entity : entities){ InternalLog log = new InternalLog(); Map<String, String> inputTags = entity.getTags(); Map<String, String> tags = new TreeMap<String, String>(); for(Map.Entry<String, String> entry : inputTags.entrySet()){ tags.put(entry.getKey(), entry.getValue()); } log.setTags(tags); log.setTimestamp(entity.getTimestamp()); log.setPrefix(entity.getPrefix()); log.setQualifierValues(mapper.createQualifierValues(entity)); byte[] rowkey = writer.write(log); rowkeys.add(EagleBase64Wrapper.encodeByteArray2URLSafeString(rowkey)); } }catch(IOException ioe){ LOG.error("Fail writing tagged log", ioe); throw ioe; }finally{ writer.close(); } return rowkeys; }
log.setTimestamp(entity.getTimestamp()); } else { log.setTimestamp(EntityConstants.FIXED_WRITE_TIMESTAMP); // set timestamp to MAX, then actually stored 0
log.setTimestamp(entity.getTimestamp()); }else{ log.setTimestamp(EntityConstants.FIXED_WRITE_TIMESTAMP); // set timestamp to MAX, then actually stored 0
internalLog.setTimestamp(System.currentTimeMillis());