private TopologyContext createTopologyContext(Map<String, Object> topoConf) { Map<Integer, String> taskToComponent = new HashMap<Integer, String>(); taskToComponent.put(7, "Xcom"); return new TopologyContext(null, topoConf, taskToComponent, null, null, null, null, null, null, 7, 6703, null, null, null, null, null, null); } }
compToStreamToFields.put(component, streamToFields); TopologyContext context = new TopologyContext(null, ConfigUtils.readStormConfig(), taskToComp,
private TopologyContext mkTopologyContext(StormTopology topology) throws IOException { Map<String, Object> conf = workerData.getConf(); return new TopologyContext( topology, workerData.getTopologyConf(), workerData.getTaskToComponent(), workerData.getComponentToSortedTasks(), workerData.getComponentToStreamToFields(), // This is updated by the Worker and the topology has shared access to it workerData.getBlobToLastKnownVersion(), workerData.getTopologyId(), ConfigUtils.supervisorStormResourcesPath( ConfigUtils.supervisorStormDistRoot(conf, workerData.getTopologyId())), ConfigUtils.workerPidsRoot(conf, workerData.getWorkerId()), taskId, workerData.getPort(), workerData.getLocalTaskIds(), workerData.getDefaultSharedResources(), workerData.getUserSharedResources(), executor.getSharedExecutorData(), executor.getIntervalToTaskToMetricToRegistry(), executor.getOpenOrPrepareWasCalled()); }
@Override @SuppressWarnings("rawtypes") public void prepare( Map<String, Object> conf, com.twitter.heron.api.topology.TopologyContext context, com.twitter.heron.api.bolt.OutputCollector collector) { topologyContextImpl = new TopologyContext(context); outputCollectorImpl = new OutputCollectorImpl(collector); delegate.prepare(conf, topologyContextImpl, outputCollectorImpl); }
@Override public void prepare(com.twitter.heron.api.topology.TopologyContext context, String component, String streamId, List<Integer> targetTasks) { TopologyContext c = new TopologyContext(context); GlobalStreamId g = new GlobalStreamId(component, streamId); delegate.prepare(c, g, targetTasks); }
@Override public void prepare(Map<String, Object> newConf, com.twitter.heron.api.topology.TopologyContext context) { this.conf = newConf; if (!newConf.containsKey(Config.STORMCOMPAT_TOPOLOGY_AUTO_TASK_HOOKS)) { throw new RuntimeException("StormCompat Translation not done for task hooks"); } List<String> hookClassNames = TypeUtils.getListOfStrings(newConf.get(Config.STORMCOMPAT_TOPOLOGY_AUTO_TASK_HOOKS)); for (String className : hookClassNames) { ITaskHook hook; try { hook = (ITaskHook) Class.forName(className).newInstance(); } catch (ClassNotFoundException ex) { throw new RuntimeException(ex + " ITaskHook class must be in class path."); } catch (InstantiationException ex) { throw new RuntimeException(ex + " ITaskHook class must be concrete."); } catch (IllegalAccessException ex) { throw new RuntimeException(ex + " ITaskHook class must have a no-arg constructor."); } hooks.add(hook); } // Invoke the prepare() for all ITaskHooks TopologyContext ctxt = new TopologyContext(context); for (ITaskHook hook : hooks) { hook.prepare(newConf, ctxt); } }
@Override public void prepare( Map<String, Object> conf, com.twitter.heron.api.topology.TopologyContext context, com.twitter.heron.api.bolt.OutputCollector collector) { topologyContextImpl = new TopologyContext(context); outputCollectorImpl = new OutputCollectorImpl(collector); delegate.prepare(conf, topologyContextImpl, outputCollectorImpl); }
@Override @SuppressWarnings("rawtypes") public void open(Map<String, Object> conf, com.twitter.heron.api.topology.TopologyContext context, SpoutOutputCollector collector) { topologyContextImpl = new TopologyContext(context); spoutOutputCollectorImpl = new SpoutOutputCollectorImpl(collector); delegate.open(conf, topologyContextImpl, spoutOutputCollectorImpl); }