Package org.apache.storm.task

## Class GeneralTopologyContext

- java.lang.Object
- - org.apache.storm.task.GeneralTopologyContext

- All Implemented Interfaces:
    `org.apache.storm.shade.net.minidev.json.JSONAware`
  Direct Known Subclasses:
    `WorkerTopologyContext`

      public class GeneralTopologyContext
      extends Object
      implements org.apache.storm.shade.net.minidev.json.JSONAware

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected boolean` | `doSanityCheck` |
    `protected Map<String,​Object>` | `topoConf` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GeneralTopologyContext​(StormTopology topology, Map<String,​Object> topoConf, Map<Integer,​String> taskToComponent, Map<String,​List<Integer>> componentToSortedTasks, Map<String,​Map<String,​Fields>> componentToStreamToFields, String stormId)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `doSanityCheck()` |
    `ComponentCommon` | `getComponentCommon​(String componentId)` |
    `String` | `getComponentId​(int taskId)` | Gets the component id for the specified task id.
    `Set<String>` | `getComponentIds()` | Gets a list of all component ids in this topology.
    `Fields` | `getComponentOutputFields​(String componentId, String streamId)` | Gets the declared output fields for the specified component/stream.
    `Fields` | `getComponentOutputFields​(GlobalStreamId id)` | Gets the declared output fields for the specified global stream id.
    `Set<String>` | `getComponentStreams​(String componentId)` | Gets the set of streams declared for the specified component.
    `List<Integer>` | `getComponentTasks​(String componentId)` | Gets the task ids allocated for the given component id.
    `Map<String,​Object>` | `getConf()` |
    `StormTopology` | `getRawTopology()` | Gets the Thrift object representing the topology.
    `Map<GlobalStreamId,​Grouping>` | `getSources​(String componentId)` | Gets the declared inputs to the specified component.
    `String` | `getStormId()` | Gets the unique id assigned to this topology.
    `Map<String,​Map<String,​Grouping>>` | `getTargets​(String componentId)` | Gets information about who is consuming the outputs of the specified component, and how.
    `Map<Integer,​String>` | `getTaskToComponent()` | Gets a map from task id to component id.
    `int` | `maxTopologyMessageTimeout()` |
    `String` | `toJSONString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### topoConf

          protected Map<String,​Object> topoConf

    - #### doSanityCheck

          protected boolean doSanityCheck

  - ### Constructor Detail

    - #### GeneralTopologyContext

          public GeneralTopologyContext​(StormTopology topology,
                                        Map<String,​Object> topoConf,
                                        Map<Integer,​String> taskToComponent,
                                        Map<String,​List<Integer>> componentToSortedTasks,
                                        Map<String,​Map<String,​Fields>> componentToStreamToFields,
                                        String stormId)

  - ### Method Detail

    - #### getStormId

          public 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 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 Set<String> getComponentStreams​(String componentId)

      Gets the set of streams declared for the specified component.

    - #### getComponentTasks

          public List<Integer> getComponentTasks​(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​(String componentId,
                                                 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 Map<GlobalStreamId,​Grouping> getSources​(String componentId)

      Gets the declared inputs to the specified component.
      Returns:
        A map from subscribed component/stream to the grouping subscribed with.

    - #### getTargets

          public Map<String,​Map<String,​Grouping>> getTargets​(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 String toJSONString()

      Specified by:
        `toJSONString` in interface `org.apache.storm.shade.net.minidev.json.JSONAware`

    - #### getTaskToComponent

          public Map<Integer,​String> getTaskToComponent()

      Gets a map from task id to component id.

    - #### getComponentIds

          public Set<String> getComponentIds()

      Gets a list of all component ids in this topology.

    - #### getComponentCommon

          public ComponentCommon getComponentCommon​(String componentId)

    - #### maxTopologyMessageTimeout

          public int maxTopologyMessageTimeout()

    - #### getConf

          public Map<String,​Object> getConf()

    - #### doSanityCheck

          public boolean doSanityCheck()