@Test @Ignore public void agent() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(AegisthusSerializerTest.class.getResourceAsStream("/agent.json"))); String line = null; StringBuilder file = new StringBuilder(); while ((line = br.readLine()) != null) { file.append(line); } new AegisthusSerializer().deserialize(file.toString()); }
public Map<String, Object> deserialize(String data) throws IOException { try { Map<String, Object> map = new LinkedHashMap<String, Object>(); JsonParser jp = jsonFactory.createJsonParser(data); jp.nextToken(); jp.nextToken(); map.put(KEY, new DataByteArray(jp.getCurrentName().getBytes())); jp.nextToken(); while (jp.nextToken() != JsonToken.END_OBJECT) { String field = jp.getCurrentName(); if (DELETEDAT.equals(field.toUpperCase())) { jp.nextToken(); map.put(DELETEDAT, jp.getLongValue()); } else { jp.nextToken(); while (jp.nextToken() != JsonToken.END_ARRAY) { List<Object> cols = new ArrayList<Object>(); jp.nextToken(); String name = jp.getText(); cols.add(name); jp.nextToken(); cols.add(new DataByteArray(jp.getText().getBytes())); jp.nextToken(); cols.add(jp.getLongValue()); if (jp.nextToken() != JsonToken.END_ARRAY) { String status = jp.getText(); cols.add(status); if ("e".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); jp.nextToken(); cols.add(jp.getLongValue()); } else if ("c".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); } jp.nextToken(); } map.put(name, cols); } } } return map; } catch (IOException e) { LOG.error(data); throw e; } }
AegisthusSerializer { public Map<String, Object> deserialize(String data) throws IOException { try { Map<String, Object> map = new LinkedHashMap<String, Object>(); JsonParser jp = jsonFactory.createJsonParser(data); jp.nextToken(); jp.nextToken(); map.put(KEY, new DataByteArray(jp.getCurrentName().getBytes())); jp.nextToken(); while (jp.nextToken() != JsonToken.END_OBJECT) { String field = jp.getCurrentName(); if (DELETEDAT.equals(field.toUpperCase())) { jp.nextToken(); map.put(DELETEDAT, jp.getLongValue()); } else { jp.nextToken(); while (jp.nextToken() != JsonToken.END_ARRAY) { List<Object> cols = new ArrayList<Object>(); jp.nextToken(); String name = jp.getText(); cols.add(name); jp.nextToken(); cols.add(new DataByteArray(jp.getText().getBytes())); jp.nextToken(); cols.add(jp.getLongValue()); if (jp.nextToken() != JsonToken.END_ARRAY) { String status = jp.getText(); cols.add(status); if ("e".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); jp.nextToken(); cols.add(jp.getLongValue()); } else if ("c".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); } jp.nextToken(); } map.put(name, cols); } } } return map; } catch (IOException e) { LOG.error(data); throw e; } } }
AegisthusSerializer { public Map<String, Object> deserialize(String data) throws IOException { try { Map<String, Object> map = new LinkedHashMap<String, Object>(); JsonParser jp = jsonFactory.createJsonParser(data); jp.nextToken(); jp.nextToken(); map.put(KEY, new DataByteArray(jp.getCurrentName().getBytes())); jp.nextToken(); while (jp.nextToken() != JsonToken.END_OBJECT) { String field = jp.getCurrentName(); if (DELETEDAT.equals(field.toUpperCase())) { jp.nextToken(); map.put(DELETEDAT, jp.getLongValue()); } else { jp.nextToken(); while (jp.nextToken() != JsonToken.END_ARRAY) { List<Object> cols = new ArrayList<Object>(); jp.nextToken(); String name = jp.getText(); cols.add(name); jp.nextToken(); cols.add(new DataByteArray(jp.getText().getBytes())); jp.nextToken(); cols.add(jp.getLongValue()); if (jp.nextToken() != JsonToken.END_ARRAY) { String status = jp.getText(); cols.add(status); if ("e".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); jp.nextToken(); cols.add(jp.getLongValue()); } else if ("c".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); } jp.nextToken(); } map.put(name, cols); } } } return map; } catch (IOException e) { LOG.error(data); throw e; } }  }
AegisthusSerializer { public Map<String, Object> deserialize(String data) throws IOException { try { Map<String, Object> map = new LinkedHashMap<String, Object>(); JsonParser jp = jsonFactory.createJsonParser(data); jp.nextToken(); jp.nextToken(); map.put(KEY, new DataByteArray(jp.getCurrentName().getBytes())); jp.nextToken(); while (jp.nextToken() != JsonToken.END_OBJECT) { String field = jp.getCurrentName(); if (DELETEDAT.equals(field.toUpperCase())) { jp.nextToken(); map.put(DELETEDAT, jp.getLongValue()); } else { jp.nextToken(); while (jp.nextToken() != JsonToken.END_ARRAY) { List<Object> cols = new ArrayList<Object>(); jp.nextToken(); String name = jp.getText(); cols.add(name); jp.nextToken(); cols.add(new DataByteArray(jp.getText().getBytes())); jp.nextToken(); cols.add(jp.getLongValue()); if (jp.nextToken() != JsonToken.END_ARRAY) { String status = jp.getText(); cols.add(status); if ("e".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); jp.nextToken(); cols.add(jp.getLongValue()); } else if ("c".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); } jp.nextToken(); } map.put(name, cols); } } } return map; } catch (IOException e) { LOG.error(data); throw e; } }  Object type(String value); Map<String, Object> deserialize(String data); static String serialize(Map<String, Object> data); }
AegisthusSerializer { public Map<String, Object> deserialize(String data) throws IOException { try { Map<String, Object> map = new LinkedHashMap<String, Object>(); JsonParser jp = jsonFactory.createJsonParser(data); jp.nextToken(); jp.nextToken(); map.put(KEY, new DataByteArray(jp.getCurrentName().getBytes())); jp.nextToken(); while (jp.nextToken() != JsonToken.END_OBJECT) { String field = jp.getCurrentName(); if (DELETEDAT.equals(field.toUpperCase())) { jp.nextToken(); map.put(DELETEDAT, jp.getLongValue()); } else { jp.nextToken(); while (jp.nextToken() != JsonToken.END_ARRAY) { List<Object> cols = new ArrayList<Object>(); jp.nextToken(); String name = jp.getText(); cols.add(name); jp.nextToken(); cols.add(new DataByteArray(jp.getText().getBytes())); jp.nextToken(); cols.add(jp.getLongValue()); if (jp.nextToken() != JsonToken.END_ARRAY) { String status = jp.getText(); cols.add(status); if ("e".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); jp.nextToken(); cols.add(jp.getLongValue()); } else if ("c".equals(status)) { jp.nextToken(); cols.add(jp.getLongValue()); } jp.nextToken(); } map.put(name, cols); } } } return map; } catch (IOException e) { LOG.error(data); throw e; } }  Object type(String value); Map<String, Object> deserialize(String data); static String serialize(Map<String, Object> data); static String DELETEDAT; static String KEY; }