当前位置: 首页>>代码示例>>Java>>正文


Java StormTopology.getFieldValue方法代码示例

本文整理汇总了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);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:25,代码来源:ThriftTopologyUtils.java

示例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);
	}

}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:46,代码来源:Common.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:11,代码来源:Common.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:ThriftTopologyUtils.java

示例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;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:ThriftTopologyUtils.java

示例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);
	}

}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:47,代码来源:Common.java


注:本文中的backtype.storm.generated.StormTopology.getFieldValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。