backtype.storm.task
Class GeneralTopologyContext

java.lang.Object
  extended by backtype.storm.task.GeneralTopologyContext
Direct Known Subclasses:
WorkerTopologyContext

public class GeneralTopologyContext
extends java.lang.Object


Field Summary
protected  java.util.Map _stormConf
           
 
Constructor Summary
GeneralTopologyContext(StormTopology topology, java.util.Map stormConf, java.util.Map<java.lang.Integer,java.lang.String> taskToComponent, java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> componentToSortedTasks, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Fields>> componentToStreamToFields, java.lang.String stormId)
           
 
Method Summary
 ComponentCommon getComponentCommon(java.lang.String componentId)
           
 java.lang.String getComponentId(int taskId)
          Gets the component id for the specified task id.
 java.util.Set<java.lang.String> getComponentIds()
          Gets a list of all component ids in this topology
 Fields getComponentOutputFields(GlobalStreamId id)
          Gets the declared output fields for the specified global stream id.
 Fields getComponentOutputFields(java.lang.String componentId, java.lang.String streamId)
          Gets the declared output fields for the specified component/stream.
 java.util.Set<java.lang.String> getComponentStreams(java.lang.String componentId)
          Gets the set of streams declared for the specified component.
 java.util.List<java.lang.Integer> getComponentTasks(java.lang.String componentId)
          Gets the task ids allocated for the given component id.
 StormTopology getRawTopology()
          Gets the Thrift object representing the topology.
 java.util.Map<GlobalStreamId,Grouping> getSources(java.lang.String componentId)
          Gets the declared inputs to the specified component.
 java.lang.String getStormId()
          Gets the unique id assigned to this topology.
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,Grouping>> getTargets(java.lang.String componentId)
          Gets information about who is consuming the outputs of the specified component, and how.
 java.util.Map<java.lang.Integer,java.lang.String> getTaskToComponent()
          Gets a map from task id to component id.
 int maxTopologyMessageTimeout()
           
 java.lang.String toJSONString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_stormConf

protected java.util.Map _stormConf
Constructor Detail

GeneralTopologyContext

public GeneralTopologyContext(StormTopology topology,
                              java.util.Map stormConf,
                              java.util.Map<java.lang.Integer,java.lang.String> taskToComponent,
                              java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> componentToSortedTasks,
                              java.util.Map<java.lang.String,java.util.Map<java.lang.String,Fields>> componentToStreamToFields,
                              java.lang.String stormId)
Method Detail

getStormId

public java.lang.String getStormId()
Gets the unique id assigned to this topology. The id is the storm name with a unique nonce appended to it.

Returns:
the storm id

getRawTopology

public StormTopology getRawTopology()
Gets the Thrift object representing the topology.

Returns:
the Thrift definition representing the topology

getComponentId

public java.lang.String getComponentId(int taskId)
Gets the component id for the specified task id. The component id maps to a component id specified for a Spout or Bolt in the topology definition.

Parameters:
taskId - the task id
Returns:
the component id for the input task id

getComponentStreams

public java.util.Set<java.lang.String> getComponentStreams(java.lang.String componentId)
Gets the set of streams declared for the specified component.


getComponentTasks

public java.util.List<java.lang.Integer> getComponentTasks(java.lang.String componentId)
Gets the task ids allocated for the given component id. The task ids are always returned in ascending order.


getComponentOutputFields

public Fields getComponentOutputFields(java.lang.String componentId,
                                       java.lang.String streamId)
Gets the declared output fields for the specified component/stream.


getComponentOutputFields

public Fields getComponentOutputFields(GlobalStreamId id)
Gets the declared output fields for the specified global stream id.


getSources

public java.util.Map<GlobalStreamId,Grouping> getSources(java.lang.String componentId)
Gets the declared inputs to the specified component.

Returns:
A map from subscribed component/stream to the grouping subscribed with.

getTargets

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,Grouping>> getTargets(java.lang.String componentId)
Gets information about who is consuming the outputs of the specified component, and how.

Returns:
Map from stream id to component id to the Grouping used.

toJSONString

public java.lang.String toJSONString()

getTaskToComponent

public java.util.Map<java.lang.Integer,java.lang.String> getTaskToComponent()
Gets a map from task id to component id.


getComponentIds

public java.util.Set<java.lang.String> getComponentIds()
Gets a list of all component ids in this topology


getComponentCommon

public ComponentCommon getComponentCommon(java.lang.String componentId)

maxTopologyMessageTimeout

public int maxTopologyMessageTimeout()