@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof TimelineEntity)) { return false; } TimelineEntity other = (TimelineEntity) obj; return getIdentifier().equals(other.getIdentifier()); }
public FlowRunEntity() { super(TimelineEntityType.YARN_FLOW_RUN.toString()); // set config to null setConfigs(null); }
public FlowActivityEntity() { super(TimelineEntityType.YARN_FLOW_ACTIVITY.toString()); // set config to null setConfigs(null); }
private static TimelineEntity createEntity(String id, String type) { TimelineEntity entityToStore = new TimelineEntity(); entityToStore.setId(id); entityToStore.setType(type); entityToStore.setCreatedTime(0L); return entityToStore; }
private static TimelineMetric getTimeSeriesMetric(String id, TimelineMetricOperation op, Map<Long, Number> metricValues) { TimelineMetric m = new TimelineMetric(); m.setId(id); m.setType(Type.TIME_SERIES); m.setRealtimeAggregationOp(op); m.setValues(metricValues); return m; }
private static TimelineEntity newEntity(String type, String id) { TimelineEntity entity = new TimelineEntity(); entity.setIdentifier(new TimelineEntity.Identifier(type, id)); return entity; }
/** * Checks if the input TimelineEntity object is an ApplicationEntity. * * @param te TimelineEntity object. * @return true if input is an ApplicationEntity, false otherwise */ public static boolean isApplicationEntity(TimelineEntity te) { return (te == null ? false : te.getType().equals(TimelineEntityType.YARN_APPLICATION.toString())); }
public FlowActivityEntity(TimelineEntity entity) { super(entity); if (!TimelineEntityType.YARN_FLOW_ACTIVITY.matches(entity.getType())) { throw new IllegalArgumentException("Incompatible entity type: " + getId()); } // set config to null setConfigs(null); }
public void setId(String id) { if (real == null) { identifier.id = id; } else { real.setId(id); } }
public void addChild(String type, String id) { addChild(new Identifier(type, id)); }
public void setParent(String type, String id) { setParent(new Identifier(type, id)); }
private void validateChild(Identifier child, TimelineEntityType thisType) { TimelineEntityType childType = TimelineEntityType.valueOf(child.getType()); if (!thisType.isChild(childType)) { throw new IllegalArgumentException( child.getType() + " is not the acceptable child of " + this.getType()); } } }
public Map<String, String> getConfigs() { if (real == null) { return configs; } else { return real.getConfigs(); } }
public Map<String, Object> getInfo() { if (real == null) { return info; } else { return real.getInfo(); } }
public FlowActivityEntity(String cluster, long time, String user, String flowName) { this(); setCluster(cluster); setDate(time); setUser(user); setFlowName(flowName); }
public void setParent(Identifier parent) { validateParent(parent.getType()); addInfo(PARENT_INFO_KEY, parent); }
public Identifier getIdentifier() { if (real == null) { return identifier; } else { return real.getIdentifier(); } }
public void setEvents(NavigableSet<TimelineEvent> entityEvents) { if (real == null) { this.events = entityEvents; } else { real.setEvents(entityEvents); } }
/** * Perform the aggregation operation. * * @param incoming Incoming metric * @param aggregate Base aggregation metric * @param state Operation state * @return Result metric for this aggregation operation */ public TimelineMetric aggregate(TimelineMetric incoming, TimelineMetric aggregate, Map<Object, Object> state) { return exec(incoming, aggregate, state); }