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


Java Bolt类代码示例

本文整理汇总了Java中org.apache.storm.generated.Bolt的典型用法代码示例。如果您正苦于以下问题:Java Bolt类的具体用法?Java Bolt怎么用?Java Bolt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Bolt类属于org.apache.storm.generated包,在下文中一共展示了Bolt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTerminalUserBoltNames

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
public static Set<String> getTerminalUserBoltNames(StormTopology topology) {
    Set<String> terminalBolts = new HashSet<>();
    Set<String> inputs = new HashSet<>();
    for (Map.Entry<String, Bolt> entry : topology.get_bolts().entrySet()) {
        String name = entry.getKey();
        Set<GlobalStreamId> inputsForBolt = entry.getValue().get_common().get_inputs().keySet();
        if (!isSystemComponent(name)) {
            for (GlobalStreamId streamId : inputsForBolt) {
                inputs.add(streamId.get_componentId());
            }
        }
    }

    for (String boltName : topology.get_bolts().keySet()) {
        if (!isSystemComponent(boltName) && !inputs.contains(boltName)) {
            terminalBolts.add(boltName);
        }
    }

    return terminalBolts;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:StormTopologyUtil.java

示例2: getAdjacencyMap

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
public static Map<String, Set<String>> getAdjacencyMap(StormTopology topology,
                                                       boolean removeSystemComponent)
throws Exception {
    Map<String, Set<String>> adjacencyMap = new HashMap<>();

    for (Map.Entry<String, Bolt> entry : topology.get_bolts().entrySet()) {
        String boltName = entry.getKey();
        Map<GlobalStreamId, Grouping> inputs = entry.getValue().get_common().get_inputs();
        for (Map.Entry<GlobalStreamId, Grouping> input : inputs.entrySet()) {
            String inputComponentId = input.getKey().get_componentId();
            Set<String> components = adjacencyMap.containsKey(inputComponentId)
                    ? adjacencyMap.get(inputComponentId) : new HashSet<String>();
            components.add(boltName);
            components = removeSystemComponent ? removeSystemComponents(components)
                    : components;
            if (!removeSystemComponent || !isSystemComponent(inputComponentId)) {
                adjacencyMap.put(inputComponentId, components);
            }
        }
    }

    return adjacencyMap;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:24,代码来源:StormTopologyUtil.java

示例3: addTopologyOutputs

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
private void addTopologyOutputs(Referenceable topologyReferenceable,
                                StormTopology stormTopology, String topologyOwner,
                                Map stormConf, List<Referenceable> dependentEntities) throws Exception {
    final ArrayList<Referenceable> outputDataSets = new ArrayList<>();

    Map<String, Bolt> bolts = stormTopology.get_bolts();
    Set<String> terminalBoltNames = StormTopologyUtil.getTerminalUserBoltNames(stormTopology);
    for (String terminalBoltName : terminalBoltNames) {
        Serializable instance = Utils.javaDeserialize(bolts.get(terminalBoltName)
                .get_bolt_object().get_serialized_java(), Serializable.class);

        String dataSetType = instance.getClass().getSimpleName();
        final Referenceable datasetRef = createDataSet(dataSetType, topologyOwner, instance, stormConf, dependentEntities);
        if (datasetRef != null) {
            outputDataSets.add(datasetRef);
        }
    }

    topologyReferenceable.set("outputs", outputDataSets);
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:21,代码来源:StormAtlasHook.java

示例4: getRawTopology

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
/**
 * Gets the Thrift object representing the topology.
 *
 * @return the Thrift definition representing the topology
 */
@SuppressWarnings("deprecation")
public StormTopology getRawTopology() {

  StormTopology stormTopology = new StormTopology();
  Map<String, SpoutSpec> spouts = new HashMap<>();
  for (TopologyAPI.Spout spout : this.delegate.getRawTopology().getSpoutsList()) {
    spouts.put(spout.getComp().getName(), new SpoutSpec(spout));
  }

  Map<String, Bolt> bolts = new HashMap<>();
  for (TopologyAPI.Bolt bolt : this.delegate.getRawTopology().getBoltsList()) {
    bolts.put(bolt.getComp().getName(), new Bolt(bolt));
  }

  stormTopology.set_spouts(spouts);
  stormTopology.set_bolts(bolts);
  return stormTopology;
}
 
开发者ID:twitter,项目名称:heron,代码行数:24,代码来源:GeneralTopologyContext.java

示例5: testAddTaskHook

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testAddTaskHook() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.addTaskHook(null);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FlinkTopologyContextTest.java

示例6: testGetHooks

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testGetHooks() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.getHooks();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FlinkTopologyContextTest.java

示例7: testRegisteredMetric1

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test(expected = UnsupportedOperationException.class)
public void testRegisteredMetric1() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.registerMetric(null, (ICombiner) null, 0);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:FlinkTopologyContextTest.java

示例8: testRegisteredMetric2

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test(expected = UnsupportedOperationException.class)
public void testRegisteredMetric2() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.registerMetric(null, (IReducer) null, 0);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:FlinkTopologyContextTest.java

示例9: testRegisteredMetric3

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testRegisteredMetric3() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.registerMetric(null, (IMetric) null, 0);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FlinkTopologyContextTest.java

示例10: testGetRegisteredMetricByName

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testGetRegisteredMetricByName() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.getRegisteredMetricByName(null);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FlinkTopologyContextTest.java

示例11: testSetAllSubscribedState

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testSetAllSubscribedState() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.setAllSubscribedState(null);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FlinkTopologyContextTest.java

示例12: testSetSubscribedState1

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testSetSubscribedState1() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.setSubscribedState(null, null);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FlinkTopologyContextTest.java

示例13: testSetSubscribedState2

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
@Test(expected = UnsupportedOperationException.class)
public void testSetSubscribedState2() {
	new FlinkTopologyContext(new StormTopology(new HashMap<String, SpoutSpec>(),
			new HashMap<String, Bolt>(), new HashMap<String, StateSpoutSpec>()), null, null,
			null, null, null, null, null, null, null, null, null, null, null, null, null)
	.setSubscribedState(null, null, null);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FlinkTopologyContextTest.java

示例14: createTopologyGraph

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
private ArrayList<Referenceable> createTopologyGraph(StormTopology stormTopology,
                                                     Map<String, SpoutSpec> spouts,
                                                     Map<String, Bolt> bolts) throws Exception {
    // Add graph of nodes in the topology
    final Map<String, Referenceable> nodeEntities = new HashMap<>();
    addSpouts(spouts, nodeEntities);
    addBolts(bolts, nodeEntities);

    addGraphConnections(stormTopology, nodeEntities);

    ArrayList<Referenceable> nodes = new ArrayList<>();
    nodes.addAll(nodeEntities.values());
    return nodes;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:15,代码来源:StormAtlasHook.java

示例15: addBolts

import org.apache.storm.generated.Bolt; //导入依赖的package包/类
private void addBolts(Map<String, Bolt> bolts,
                      Map<String, Referenceable> nodeEntities) throws IllegalAccessException {
    for (Map.Entry<String, Bolt> entry : bolts.entrySet()) {
        Referenceable boltInstance = createBoltInstance(entry.getKey(), entry.getValue());
        nodeEntities.put(entry.getKey(), boltInstance);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:8,代码来源:StormAtlasHook.java


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