當前位置: 首頁>>代碼示例>>Java>>正文


Java StormTopology._Fields方法代碼示例

本文整理匯總了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);
}
 
開發者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._Fields方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。