本文整理汇总了Java中backtype.storm.generated.StormTopology._Fields方法的典型用法代码示例。如果您正苦于以下问题:Java StormTopology._Fields方法的具体用法?Java StormTopology._Fields怎么用?Java StormTopology._Fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backtype.storm.generated.StormTopology
的用法示例。
在下文中一共展示了StormTopology._Fields方法的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);
}
}