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; }
InternalLog log = new InternalLog(); String myRow = EagleBase64Wrapper.encodeByteArray2URLSafeString(row); log.setEncodedRowkey(myRow);
InternalLog log = new InternalLog(); String myRow = EagleBase64Wrapper.encodeByteArray2URLSafeString(row); log.setEncodedRowkey(myRow);
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; }
public void updateByRowkey(List<? extends TaggedLogAPIEntity> entities) throws IOException { HBaseLogWriter writer = new HBaseLogWriter(table, columnFamily); try { writer.open(); for (TaggedLogAPIEntity entity : entities) { byte[] rowkey = EagleBase64Wrapper.decode(entity.getEncodedRowkey()); InternalLog log = new InternalLog(); log.setQualifierValues(mapper.createQualifierValues(entity)); writer.updateByRowkey(rowkey, log); } } catch (IOException ioe) { LOG.error("Fail writing tagged log", ioe); throw ioe; } finally { writer.close(); } } }
public void updateByRowkey(List<? extends TaggedLogAPIEntity> entities) throws IOException{ HBaseLogWriter writer = new HBaseLogWriter(table, columnFamily); try{ writer.open(); for(TaggedLogAPIEntity entity : entities){ byte[] rowkey = EagleBase64Wrapper.decode(entity.getEncodedRowkey()); InternalLog log = new InternalLog(); log.setQualifierValues(mapper.createQualifierValues(entity)); writer.updateByRowkey(rowkey, log); } }catch(IOException ioe){ LOG.error("Fail writing tagged log", ioe); throw ioe; }finally{ writer.close(); } } }
public static InternalLog convertToInternalLog(TaggedLogAPIEntity entity, EntityDefinition entityDef) throws Exception { final InternalLog log = new InternalLog(); final Map<String, String> inputTags = entity.getTags(); final Map<String, String> tags = new TreeMap<String, String>();
public static InternalLog convertToInternalLog(TaggedLogAPIEntity entity, EntityDefinition entityDef) throws Exception { final InternalLog log = new InternalLog(); final Map<String, String> inputTags = entity.getTags(); final Map<String, String> tags = new TreeMap<String, String>();
@Test public void testTimeSeriesAPIEntity() { InternalLog internalLog = new InternalLog(); Map<String, byte[]> map = new HashMap<String, byte[]>(); TestTimeSeriesAPIEntity apiEntity = new TestTimeSeriesAPIEntity();