public static Map<String, Object> convertEdgeProperty(EdgeProperty edge) { Map<String, Object> jsonDescriptor = new HashMap<String, Object>(); jsonDescriptor.put(DATA_MOVEMENT_TYPE_KEY, edge.getDataMovementType().name()); jsonDescriptor.put(DATA_SOURCE_TYPE_KEY, edge.getDataSourceType().name()); jsonDescriptor.put(SCHEDULING_TYPE_KEY, edge.getSchedulingType().name()); jsonDescriptor.put(EDGE_SOURCE_CLASS_KEY, edge.getEdgeSource().getClassName()); jsonDescriptor.put(EDGE_DESTINATION_CLASS_KEY, edge.getEdgeDestination().getClassName()); String history = edge.getEdgeSource().getHistoryText(); if (history != null) { jsonDescriptor.put(OUTPUT_USER_PAYLOAD_AS_TEXT, history); } history = edge.getEdgeDestination().getHistoryText(); if (history != null) { jsonDescriptor.put(INPUT_USER_PAYLOAD_AS_TEXT, history); } EdgeManagerPluginDescriptor descriptor = edge.getEdgeManagerDescriptor(); if (descriptor != null) { jsonDescriptor.put(EDGE_MANAGER_CLASS_KEY, descriptor.getClassName()); if (descriptor.getHistoryText() != null && !descriptor.getHistoryText().isEmpty()) { jsonDescriptor.put(USER_PAYLOAD_AS_TEXT, descriptor.getHistoryText()); } } return jsonDescriptor; }
@SuppressWarnings("rawtypes") public Edge(EdgeProperty edgeProperty, EventHandler eventHandler) { this.edgeProperty = edgeProperty; this.eventHandler = eventHandler; switch (edgeProperty.getDataMovementType()) { case ONE_TO_ONE: edgeManager = new OneToOneEdgeManager(); break; case BROADCAST: edgeManager = new BroadcastEdgeManager(); break; case SCATTER_GATHER: edgeManager = new ScatterGatherEdgeManager(); break; default: String message = "Unknown edge data movement type: " + edgeProperty.getDataMovementType(); throw new TezUncheckedException(message); } }
SourceVertexInfo(EdgeProperty edgeProperty) { this.edgeProperty = edgeProperty; if (edgeProperty.getDataMovementType() == DataMovementType.SCATTER_GATHER) { finishedTaskSet = new BitSet(); } }