/** * @see stream.Processor#process(stream.Data) */ @Override public Data processMatchingData(Data input) { if (oldKey != null && newKey != null && input.containsKey(oldKey)) { if (input.containsKey(newKey)) log.warn("Overwriting existing key '{}'!", newKey); Serializable o = input.remove(oldKey); input.put(newKey, o); } return input; } }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data processMatchingData(Data input) { if (oldKey != null && newKey != null && input.containsKey(oldKey)) { if (input.containsKey(newKey)) log.warn("Overwriting existing key '{}'!", newKey); Serializable o = input.remove(oldKey); input.put(newKey, o); } return input; } }
public boolean check(Data item) { log.info("Checking {} types for item {}", types.keySet().size(), item); for (String key : types.keySet()) { if (!item.containsKey(key)) { log.error("Missing key '{}' in item {}!", key, item); return false; } if (!checkType(key, item)) { log.error("Value type mismatch for key '" + key + "', expected type: {} but found type: {}", types.get(key), item.get(key).getClass()); return false; } } return true; }
public boolean check(Data item) { log.info("Checking {} types for item {}", types.keySet().size(), item); for (String key : types.keySet()) { if (!item.containsKey(key)) { log.error("Missing key '{}' in item {}!", key, item); return false; } if (!checkType(key, item)) { log.error("Value type mismatch for key '" + key + "', expected type: {} but found type: {}", types.get(key), item.get(key).getClass()); return false; } } return true; }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data input) { if (oldKey != null && newKey != null && input.containsKey(oldKey)) { if (input.containsKey(newKey)) log.warn("Overwriting existing key '{}'!", newKey); Serializable o = input.remove(oldKey); input.put(newKey, o); } for (String key : mapping.keySet()) { if (input.containsKey(key)) { Serializable value = input.remove(key); input.put(mapping.get(key), value); } } return input; }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data input) { if (oldKey != null && newKey != null && input.containsKey(oldKey)) { if (input.containsKey(newKey)) log.warn("Overwriting existing key '{}'!", newKey); Serializable o = input.remove(oldKey); input.put(newKey, o); } for (String key : mapping.keySet()) { if (input.containsKey(key)) { Serializable value = input.remove(key); input.put(mapping.get(key), value); } } return input; }
/** * @see stream.Processor#process(stream.Data) */ @Override public final Data process(Data input) { for (String key : types.keySet()) { if (!input.containsKey(key)) { throw new RuntimeException("Required key '" + key + "' not present in input data!"); } Serializable val = input.get(key); Class<?> type = types.get(key); if (!type.isAssignableFrom(val.getClass())) { throw new RuntimeException(""); } } return processItem(input); }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data input) { if (oldKey != null && newKey != null && input.containsKey(oldKey)) { if (input.containsKey(newKey)) log.warn("Overwriting existing key '{}'!", newKey); Serializable o = input.remove(oldKey); input.put(newKey, o); } for (String key : mapping.keySet()) { if (input.containsKey(key)) { Serializable value = input.remove(key); input.put(mapping.get(key), value); } } return input; }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data item) { for( String key : keys.select( item)) { states.put( key, item.get( key)); } for( String key : states.keySet()) { if( ! item.containsKey( key )) { item.put( key, states.get( key)); } } return item; } }
/** * Returns the given data item, with the specified key being hidden. * * @param key * @param item * @return * @deprecated */ public final static Data hide(String key, Data item) { if (item.containsKey(key)) { Serializable o = item.remove(key); item.put(Data.HIDDEN_PREFIX + key, o); } return item; }
/** * Returns the given data item, with the specified key being hidden. * * @param key * @param item * @return * @deprecated */ public final static Data hide(String key, Data item) { if (item.containsKey(key)) { Serializable o = item.remove(key); item.put(Data.HIDDEN_PREFIX + key, o); } return item; }
/** * Returns the given data item, with the specified hidden key being * un-hidden. * * @param key * @param item * @return * @deprecated */ public final static Data unhide(String key, Data item) { String hidden = Data.HIDDEN_PREFIX + key; if (item.containsKey(hidden)) { Serializable o = item.remove(hidden); item.put(key, o); } return item; }
/** * Returns the given data item, with the specified hidden key being * un-hidden. * * @param key * @param item * @return * @deprecated */ public final static Data unhide(String key, Data item) { String hidden = Data.HIDDEN_PREFIX + key; if (item.containsKey(hidden)) { Serializable o = item.remove(hidden); item.put(key, o); } return item; }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data input) { if (key == null || !input.containsKey(key)) return input; String text = input.get(key).toString(); Map<String, String> vars = new HashMap<String, String>(); for (String k : input.keySet()) { vars.put("data." + k, input.get(k).toString()); } String expanded = substitute(text, emptyStrings, vars); input.put(key, expanded); return input; }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data input) { if (key == null || !input.containsKey(key)) return input; String text = input.get(key).toString(); Map<String, String> vars = new HashMap<String, String>(); for (String k : input.keySet()) { vars.put("data." + k, input.get(k).toString()); } String expanded = substitute(text, emptyStrings, vars); input.put(key, expanded); return input; }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data input) { if (key == null || !input.containsKey(key)) return input; String text = input.get(key).toString(); Map<String, String> vars = new HashMap<String, String>(); for (String k : input.keySet()) { vars.put("data." + k, input.get(k).toString()); } String expanded = substitute(text, emptyStrings, vars); input.put(key, expanded); return input; }
/** * @see stream.io.CsvWriter#write(stream.Data) */ @Override public void write(Data datum) { Data item = DataFactory.create(); for (String key : this.selectedKeys(datum)) { if (datum.containsKey(key)) item.put(key, datum.get(key)); } if (p != null) { p.println(JSONObject.toJSONString(item)); } else { log.error("JSONWriter has not been set right: PrintStream is null."); } } }
/** * @see stream.io.CsvWriter#write(stream.Data) */ @Override public void write(Data datum) { Data item = DataFactory.create(); for (String key : this.selectedKeys(datum)) { if (datum.containsKey(key)) item.put(key, datum.get(key)); } if (p != null) { p.println(JSONObject.toJSONString(item)); } else { log.error("JSONWriter has not been set right: PrintStream is null."); } } }
/** * @see stream.io.CsvWriter#write(stream.Data) */ @Override public void write(Data datum) { if (this.keys != null) { Data item = DataFactory.create(); for (String key : KeyFilter.select(datum, keys)) { if (datum.containsKey(key)) item.put(key, datum.get(key)); } p.println(JSONObject.toJSONString(item)); } else p.println(JSONObject.toJSONString(datum)); } }
public IronBeeAuditEvent(Data data) { put(ModSecurity.TX_ID, data.get(SECTION_BOUNDARY_KEY) + ""); for (String key : data.keySet()) { Serializable val = data.get(key); if (val instanceof String) { String repl = mapVariable(key); log.trace(" Replacing '{}' with '{}'", key, repl); put(repl, val.toString()); } } if (data.containsKey("event_messages")) { try { AuditEventMessage[] msgs = (AuditEventMessage[]) data .get("event_messages"); messages = msgs; } catch (Exception e) { e.printStackTrace(); } } }