/** * Gets the set of streams declared for the specified component. */ public Set<String> getComponentStreams(String componentId) { return getComponentCommon(componentId).get_streams().keySet(); }
/** * Gets the set of streams declared for the specified component. */ public Set<String> getComponentStreams(String componentId) { return getComponentCommon(componentId).get_streams().keySet(); }
public IdDictionary(StormTopology topology) { List<String> componentNames = new ArrayList<>(topology.get_spouts().keySet()); componentNames.addAll(topology.get_bolts().keySet()); componentNames.addAll(topology.get_state_spouts().keySet()); for (String name : componentNames) { ComponentCommon common = Utils.getComponentCommon(topology, name); List<String> streams = new ArrayList<>(common.get_streams().keySet()); streamNametoId.put(name, idify(streams)); streamIdToName.put(name, Utils.reverseMap(streamNametoId.get(name))); } }
public HashMap<String, Map<String, Fields>> generateComponentToStreamToFields(StormTopology topology) { HashMap<String, Map<String, Fields>> componentToStreamToFields = new HashMap<>(); Set<String> components = ThriftTopologyUtils.getComponentIds(topology); for (String component : components) { Map<String, Fields> streamToFieldsMap = new HashMap<>(); Map<String, StreamInfo> streamInfoMap = ThriftTopologyUtils.getComponentCommon(topology, component).get_streams(); for (Map.Entry<String, StreamInfo> entry : streamInfoMap.entrySet()) { String streamId = entry.getKey(); StreamInfo streamInfo = entry.getValue(); streamToFieldsMap.put(streamId, new Fields(streamInfo.get_output_fields())); } componentToStreamToFields.put(component, streamToFieldsMap); } return componentToStreamToFields; }
public Object getFieldValue(_Fields field) { switch (field) { case INPUTS: return get_inputs(); case STREAMS: return get_streams(); case PARALLELISM_HINT: return Integer.valueOf(get_parallelism_hint()); case JSON_CONF: return get_json_conf(); } throw new IllegalStateException(); }
public static Set<String> getEndBolts(StormTopology topology) { Set<String> endBolts = new HashSet<>(); Map<String, Bolt> bolts = topology.get_bolts(); for (Entry<String, Bolt> entry : bolts.entrySet()) { String componentId = entry.getKey(); Bolt bolt = entry.getValue(); Map<String, StreamInfo> outputStreams = bolt.get_common().get_streams(); if (outputStreams.size() == 0) { endBolts.add(entry.getKey()); } else { // Try to check if there is any "real" downstream for the output stream boolean found = false; for (String streamId : outputStreams.keySet()) { if (hasDownstreamComponent(topology, componentId, streamId)) { found = true; break; } } if (!found) endBolts.add(entry.getKey()); } } return endBolts; }
public IdDictionary(StormTopology topology) { List<String> componentNames = new ArrayList<String>(topology.get_spouts().keySet()); componentNames.addAll(topology.get_bolts().keySet()); componentNames.addAll(topology.get_state_spouts().keySet()); for(String name: componentNames) { ComponentCommon common = Utils.getComponentCommon(topology, name); List<String> streams = new ArrayList<String>(common.get_streams().keySet()); streamNametoId.put(name, idify(streams)); streamIdToName.put(name, Utils.reverseMap(streamNametoId.get(name))); } }
/** * Gets the declared output fields for the specified component/stream. */ public Fields getComponentOutputFields(String componentId, String streamId) { StreamInfo streamInfo = getComponentCommon(componentId).get_streams().get(streamId); if(streamInfo==null) { throw new IllegalArgumentException("No output fields defined for component:stream " + componentId + ":" + streamId); } return new Fields(streamInfo.get_output_fields()); }
public Object getFieldValue(_Fields field) { switch (field) { case INPUTS: return get_inputs(); case STREAMS: return get_streams(); case PARALLELISM_HINT: return Integer.valueOf(get_parallelism_hint()); case JSON_CONF: return get_json_conf(); } throw new IllegalStateException(); }
static void validate_component(Object obj) throws InvalidTopologyException { if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id)) { throw new InvalidTopologyException(id + " is not a valid component id"); } } } if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id)) { throw new InvalidTopologyException(id + " is not a valid component id"); } } } if (obj instanceof Bolt) { Bolt spec = (Bolt) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id)) { throw new InvalidTopologyException(id + " is not a valid component id"); } } } }
private static void validate_component(Object obj) throws InvalidTopologyException { if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else if (obj instanceof Bolt) { Bolt spec = (Bolt) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else { throw new InvalidTopologyException("Unknown component type"); } }
/** * Gets the set of streams declared for the specified component. */ public Set<String> getComponentStreams(String componentId) { return getComponentCommon(componentId).get_streams().keySet(); }
/** * Gets the set of streams declared for the specified component. */ public Set<String> getComponentStreams(String componentId) { return getComponentCommon(componentId).get_streams().keySet(); }
public static Set<String> getEndBolts(StormTopology topology, String sourceId) { Set<String> endBolts = new HashSet<String>(); Map<String, Bolt> bolts = topology.get_bolts(); for (Entry<String, Bolt> entry : bolts.entrySet()) { Bolt bolt = entry.getValue(); Map<String, StreamInfo> outputStreams = bolt.get_common().get_streams(); if (outputStreams.size() == 0) { endBolts.add(entry.getKey()); } } return endBolts; } }
public IdDictionary(StormTopology topology) { List<String> componentNames = new ArrayList<String>(topology.get_spouts().keySet()); componentNames.addAll(topology.get_bolts().keySet()); componentNames.addAll(topology.get_state_spouts().keySet()); for (String name : componentNames) { ComponentCommon common = Utils.getComponentCommon(topology, name); List<String> streams = new ArrayList<String>(common.get_streams().keySet()); streamNametoId.put(name, idify(streams)); streamIdToName.put(name, Utils.reverseMap(streamNametoId.get(name))); } }
public IdDictionary(StormTopology topology) { List<String> componentNames = new ArrayList<String>(topology.get_spouts().keySet()); componentNames.addAll(topology.get_bolts().keySet()); componentNames.addAll(topology.get_state_spouts().keySet()); for(String name: componentNames) { ComponentCommon common = Utils.getComponentCommon(topology, name); List<String> streams = new ArrayList<String>(common.get_streams().keySet()); streamNametoId.put(name, idify(streams)); streamIdToName.put(name, Utils.reverseMap(streamNametoId.get(name))); } }
public HashMap<String, Map<String, Fields>> generateComponentToStreamToFields(StormTopology topology) { HashMap<String, Map<String, Fields>> componentToStreamToFields = new HashMap<String, Map<String, Fields>>(); Set<String> components = ThriftTopologyUtils.getComponentIds(topology); for (String component : components) { Map<String, Fields> streamToFieldsMap = new HashMap<String, Fields>(); Map<String, StreamInfo> streamInfoMap = ThriftTopologyUtils.getComponentCommon(topology, component).get_streams(); for (Map.Entry<String, StreamInfo> entry : streamInfoMap.entrySet()) { String streamId = entry.getKey(); StreamInfo streamInfo = entry.getValue(); streamToFieldsMap.put(streamId, new Fields(streamInfo.get_output_fields())); } componentToStreamToFields.put(component, streamToFieldsMap); } return componentToStreamToFields; }
public Object getFieldValue(_Fields field) { switch (field) { case INPUTS: return get_inputs(); case STREAMS: return get_streams(); case PARALLELISM_HINT: return Integer.valueOf(get_parallelism_hint()); case JSON_CONF: return get_json_conf(); } throw new IllegalStateException(); }
public Object getFieldValue(_Fields field) { switch (field) { case INPUTS: return get_inputs(); case STREAMS: return get_streams(); case PARALLELISM_HINT: return Integer.valueOf(get_parallelism_hint()); case JSON_CONF: return get_json_conf(); } throw new IllegalStateException(); }
private static void validate_component(Object obj) throws InvalidTopologyException { if (obj instanceof StateSpoutSpec) { StateSpoutSpec spec = (StateSpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else if (obj instanceof SpoutSpec) { SpoutSpec spec = (SpoutSpec) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else if (obj instanceof Bolt) { Bolt spec = (Bolt) obj; for (String id : spec.get_common().get_streams().keySet()) { if (system_id(id) || !charComponentValidate(id)) { throw new InvalidTopologyException(id + " is not a valid component id. " + compErrorInfo); } } } else { throw new InvalidTopologyException("Unknow type component"); } }