本文整理匯總了Java中backtype.storm.generated.StormTopology.getFieldValue方法的典型用法代碼示例。如果您正苦於以下問題:Java StormTopology.getFieldValue方法的具體用法?Java StormTopology.getFieldValue怎麽用?Java StormTopology.getFieldValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類backtype.storm.generated.StormTopology
的用法示例。
在下文中一共展示了StormTopology.getFieldValue方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getComponentCommon
import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
public static ComponentCommon getComponentCommon(StormTopology topology,
String componentId) {
for (StormTopology._Fields f : StormTopology.metaDataMap.keySet()) {
Map<String, Object> componentMap = (Map<String, Object>) topology
.getFieldValue(f);
if (componentMap.containsKey(componentId)) {
Object component = componentMap.get(componentId);
if (component instanceof Bolt) {
return ((Bolt) component).get_common();
}
if (component instanceof SpoutSpec) {
return ((SpoutSpec) component).get_common();
}
if (component instanceof StateSpoutSpec) {
return ((StateSpoutSpec) component).get_common();
}
throw new RuntimeException(
"Unreachable code! No get_common conversion for component "
+ component);
}
}
throw new IllegalArgumentException(
"Could not find component common for " + componentId);
}
示例2: validate_ids
import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
/**
* Check Whether ID of Bolt or spout is system_id
*
* @param topology
* @throws InvalidTopologyException
*/
public static void validate_ids(StormTopology topology, String topologyId)
throws InvalidTopologyException {
String topologyName = TopologyIdToName(topologyId);
if (!charValidate(topologyName)) {
throw new InvalidTopologyException(topologyName +
" is not a valid topology name. " + nameErrorInfo);
}
List<String> list = new ArrayList<String>();
for (StormTopology._Fields field : Thrift.STORM_TOPOLOGY_FIELDS) {
Object value = topology.getFieldValue(field);
if (value != null) {
Map<String, Object> obj_map = (Map<String, Object>) value;
Set<String> commids = obj_map.keySet();
for (String id : commids) {
if (system_id(id) || !charComponentValidate(id)) {
throw new InvalidTopologyException(id
+ " is not a valid component id. " + compErrorInfo);
}
}
for (Object obj : obj_map.values()) {
validate_component(obj);
}
list.addAll(commids);
}
}
List<String> offending = JStormUtils.getRepeat(list);
if (offending.isEmpty() == false) {
throw new InvalidTopologyException("Duplicate component ids: "
+ offending);
}
}
示例3: all_components
import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
public static List<Object> all_components(StormTopology topology) {
List<Object> rtn = new ArrayList<Object>();
for (StormTopology._Fields field : Thrift.STORM_TOPOLOGY_FIELDS) {
Object fields = topology.getFieldValue(field);
if (fields != null) {
rtn.addAll(((Map) fields).values());
}
}
return rtn;
}
示例4: getComponentIds
import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
public static Set<String> getComponentIds(StormTopology topology) {
Set<String> ret = new HashSet<String>();
for (StormTopology._Fields f : StormTopology.metaDataMap.keySet()) {
Map<String, Object> componentMap = (Map<String, Object>) topology
.getFieldValue(f);
ret.addAll(componentMap.keySet());
}
return ret;
}
示例5: getComponents
import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
public static Map<String, Object> getComponents(StormTopology topology) {
Map<String, Object> ret = new HashMap<String, Object>();
for (StormTopology._Fields f : StormTopology.metaDataMap.keySet()) {
Map<String, Object> componentMap = (Map<String, Object>) topology
.getFieldValue(f);
ret.putAll(componentMap);
}
return ret;
}
示例6: validate_ids
import backtype.storm.generated.StormTopology; //導入方法依賴的package包/類
/**
* Check Whether ID of Bolt or spout is system_id
*
* @param topology
* @throws InvalidTopologyException
*/
@SuppressWarnings("unchecked")
public static void validate_ids(StormTopology topology, String topologyId)
throws InvalidTopologyException {
String topologyName = TopologyIdToName(topologyId);
if (!charValidate(topologyName)) {
throw new InvalidTopologyException(topologyName +
" is not a valid topology name. " + nameErrorInfo);
}
List<String> list = new ArrayList<String>();
for (StormTopology._Fields field : Thrift.STORM_TOPOLOGY_FIELDS) {
Object value = topology.getFieldValue(field);
if (value != null) {
Map<String, Object> obj_map = (Map<String, Object>) value;
Set<String> commids = obj_map.keySet();
for (String id : commids) {
if (system_id(id) || !charComponentValidate(id)) {
throw new InvalidTopologyException(id
+ " is not a valid component id. " + compErrorInfo);
}
}
for (Object obj : obj_map.values()) {
validate_component(obj);
}
list.addAll(commids);
}
}
List<String> offending = JStormUtils.getRepeat(list);
if (offending.isEmpty() == false) {
throw new InvalidTopologyException("Duplicate component ids: "
+ offending);
}
}