@Override public String toString() { return Strings.hex(hash).toString(); } }
@Override public String toString() { return Strings.hex(hash).toString(); } }
public static StringBuilder join(byte[]... objects) { StringBuilder streamList = new StringBuilder(); for (int i = 0; i < objects.length; i++) { if (i > 0) streamList.append(", "); streamList.append(hex(objects[i])); } return streamList; }
@Override public Plaintext getMessage(byte[] initialHash) { return single(find("initial_hash=X'" + Strings.hex(initialHash) + "'")); }
@Override public Plaintext getMessageForAck(byte[] ackData) { return single(find("ack_data=X'" + Strings.hex(ackData) + "' AND status='" + Plaintext.Status.SENT + "'")); }
throw new IllegalArgumentException("Object requested that we don't have. Initial hash: " + Strings.hex(initialHash));
private NetworkAddress loadExisting(NetworkAddress node) { String query = "SELECT stream, address, port, services, time" + " FROM Node" + " WHERE stream = " + node.getStream() + " AND address = X'" + Strings.hex(node.getIPv6()) + "'" + " AND port = " + node.getPort(); try ( Connection connection = config.getConnection(); Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(query) ) { if (rs.next()) { return new NetworkAddress.Builder() .stream(rs.getLong("stream")) .ipv6(rs.getBytes("address")) .port(rs.getInt("port")) .services(rs.getLong("services")) .time(rs.getLong("time")) .build(); } else { return null; } } catch (Exception e) { LOG.error(e.getMessage(), e); throw new ApplicationException(e); } }