/** * Returns true if the event matches the filter. * * @param ievent {@link DeserializedEvent} has payload to filter against. */ @Override public boolean test(InternalEvent ievent) { DeserializedEvent devent = ievent.getEventObj(); if (devent == null) { return false; } boolean found; try { String field = devent.getFieldAsString(this.path); found = this.pattern.matcher(field).matches(); } catch (FieldNotFoundException e) { found = false; } /* * When false is returned then the event is excluded from the stream. */ return this.exclude != found; } }
/** * Returns true if the event matches the filter. * * @param ievent {@link DeserializedEvent} has payload to filter against. */ @Override public boolean test(InternalEvent ievent) { DeserializedEvent devent = ievent.getEventObj(); if (devent == null) { return false; } boolean found; try { String field = devent.getFieldAsString(this.path); found = this.pattern.matcher(field).matches(); } catch (FieldNotFoundException e) { found = false; } /* * When false is returned then the event is excluded from the stream. */ return this.exclude != found; } }
protected static Pair<String, Object> getFieldAndSource(DeserializedEvent devent, List<String> sourceFieldsNames, boolean asString) throws FieldNotFoundException { Object sourceValue = null; String foundSourceFieldName = null; for (String sourceFieldName : sourceFieldsNames) { try { if (asString) { sourceValue = devent.getFieldAsString(sourceFieldName); } else { sourceValue = devent.getField(sourceFieldName); } foundSourceFieldName = sourceFieldName; break; } catch (FieldNotFoundException e) { continue; } } if (sourceValue == null) { throw new FieldNotFoundException(); } return new ImmutablePair<String, Object>(foundSourceFieldName, sourceValue); } }
protected static Pair<String, Object> getFieldAndSource(DeserializedEvent devent, List<String> sourceFieldsNames, boolean asString) throws FieldNotFoundException { Object sourceValue = null; String foundSourceFieldName = null; for (String sourceFieldName : sourceFieldsNames) { try { if (asString) { sourceValue = devent.getFieldAsString(sourceFieldName); } else { sourceValue = devent.getField(sourceFieldName); } foundSourceFieldName = sourceFieldName; break; } catch (FieldNotFoundException e) { continue; } } if (sourceValue == null) { throw new FieldNotFoundException(); } return new ImmutablePair<String, Object>(foundSourceFieldName, sourceValue); } }
/** * Provided a PartitionSpec this method attempts to retrieve each field from the deserialized * event object. * * @param devent deserialized event to extract partitions from */ protected LinkedHashMap<String, String> getPartitions(DeserializedEvent devent) { int numPartSpecs = partitionSpecs.size(); /* * Loop through each partition spec fetching the associated field from the event. Set to null if * field does not exist. */ LinkedHashMap<String, String> partitions = new LinkedHashMap<String, String>(numPartSpecs); for (PartitionSpec spec : partitionSpecs) { String key = null; for (String source : spec.getSources()) { try { key = devent.getFieldAsString(source); if (key != null) { break; } } catch (FieldNotFoundException e) { continue; } } partitions.put(spec.getName(), spec.interpret(key)); } return partitions; }
/** * Provided a PartitionSpec this method attempts to retrieve each field from the deserialized * event object. * * @param devent deserialized event to extract partitions from */ protected LinkedHashMap<String, String> getPartitions(DeserializedEvent devent) { int numPartSpecs = partitionSpecs.size(); /* * Loop through each partition spec fetching the associated field from the event. Set to null if * field does not exist. */ LinkedHashMap<String, String> partitions = new LinkedHashMap<String, String>(numPartSpecs); for (PartitionSpec spec : partitionSpecs) { String key = null; for (String source : spec.getSources()) { try { key = devent.getFieldAsString(source); if (key != null) { break; } } catch (FieldNotFoundException e) { continue; } } partitions.put(spec.getName(), spec.interpret(key)); } return partitions; }
String sourceValue; try { sourceValue = devent.getFieldAsString(sourceField); } catch (FieldNotFoundException e) { continue;
String sourceValue; try { sourceValue = devent.getFieldAsString(sourceField); } catch (FieldNotFoundException e) { continue;
@Override public InternalEvent perform(InternalEvent ievent) { String field; try { field = ievent.getEventObj().getFieldAsString(timeField); } catch (FieldNotFoundException e) { throw new OperationException( "time field " + timeField + " does not exist in " + ievent.getEventString()); } ievent.setEventTime(getTimestamp(field, timeFieldType)); return ievent; } }
@Override public InternalEvent perform(InternalEvent ievent) { String field; try { field = ievent.getEventObj().getFieldAsString(timeField); } catch (FieldNotFoundException e) { throw new OperationException( "time field " + timeField + " does not exist in " + ievent.getEventString()); } ievent.setEventTime(getTimestamp(field, timeFieldType)); return ievent; } }
ipStr = ievent.getEventObj().getFieldAsString(this.pathToIpAddress); } catch (FieldNotFoundException e) { if (!this.required) {
value = ievent.getEventObj().getFieldAsString(fieldName); } catch (FieldNotFoundException e) { continue;
value = ievent.getEventObj().getFieldAsString(fieldName); } catch (FieldNotFoundException e) { continue;
ipStr = ievent.getEventObj().getFieldAsString(this.pathToIpAddress); } catch (FieldNotFoundException e) { if (!this.required) {