Package org.apache.storm.daemon

## Class StormCommon

- java.lang.Object
- - org.apache.storm.daemon.StormCommon

-     public class StormCommon
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `EVENTLOGGER_COMPONENT_ID` |
    `static String` | `EVENTLOGGER_STREAM_ID` |
    `static String` | `SYSTEM_STREAM_ID` |
    `static String` | `TOPOLOGY_EVENT_LOGGER_ARGUMENTS` |
    `static String` | `TOPOLOGY_EVENT_LOGGER_CLASS` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_ARGUMENT` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_BLACKLIST` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_CLASS` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_EXPAND_MAP_TYPE` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_MAX_RETAIN_METRIC_TUPLES` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_METRIC_NAME_SEPARATOR` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_PARALLELISM_HINT` |
    `static String` | `TOPOLOGY_METRICS_CONSUMER_WHITELIST` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `StormCommon()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Map<GlobalStreamId,​Grouping>` | `ackerInputs​(StormTopology topology)` |
    `static void` | `addAcker​(Map<String,​Object> conf, StormTopology topology)` |
    `static void` | `addEventLogger​(Map<String,​Object> conf, StormTopology topology)` |
    `static void` | `addMetricComponents​(Map<String,​Object> conf, StormTopology topology)` |
    `static void` | `addMetricStreams​(StormTopology topology)` |
    `static void` | `addSystemComponents​(Map<String,​Object> conf, StormTopology topology)` |
    `static void` | `addSystemStreams​(StormTopology topology)` |
    `static Map<String,​Object>` | `allComponents​(StormTopology topology)` |
    `static Map<String,​Object>` | `componentConf​(Object component)` |
    `static List<String>` | `eventLoggerBoltFields()` |
    `static Map<GlobalStreamId,​Grouping>` | `eventLoggerInputs​(StormTopology topology)` |
    `static List<Integer>` | `executorIdToTasks​(List<Long> executorId)` |
    `static ComponentCommon` | `getComponentCommon​(Object component)` |
    `static boolean` | `hasAckers​(Map<String,​Object> topoConf)` |
    `static boolean` | `hasEventLoggers​(Map<String,​Object> topoConf)` |
    `static IBolt` | `makeAckerBolt()` |
    `IBolt` | `makeAckerBoltImpl()` |
    `static WorkerTopologyContext` | `makeWorkerContext​(Map<String,​Object> workerData)` |
    `static Map<String,​Bolt>` | `metricsConsumerBoltSpecs​(Map<String,​Object> conf, StormTopology topology)` |
    `static IAuthorizer` | `mkAuthorizationHandler​(String klassName, Map<String,​Object> conf)` |
    `protected IAuthorizer` | `mkAuthorizationHandlerImpl​(String klassName, Map<String,​Object> conf)` |
    `static int` | `numStartExecutors​(Object component)` |
    `static StormCommon` | `setInstance​(StormCommon common)` | Provide an instance of this class for delegates to use.
    `static Map<Integer,​String>` | `stormTaskInfo​(StormTopology userTopology, Map<String,​Object> topoConf)` |
    `protected Map<Integer,​String>` | `stormTaskInfoImpl​(StormTopology userTopology, Map<String,​Object> topoConf)` |
    `static StormTopology` | `systemTopology​(Map<String,​Object> topoConf, StormTopology topology)` | Construct a new topology structure after adding system components and streams.
    `protected StormTopology` | `systemTopologyImpl​(Map<String,​Object> topoConf, StormTopology topology)` |
    `static Map<Integer,​NodeInfo>` | `taskToNodeport​(Map<List<Long>,​NodeInfo> executorToNodePort)` |
    `static void` | `validateBasic​(StormTopology topology)` |
    `static void` | `validateDistributedMode​(Map<String,​Object> conf)` |
    `static void` | `validateStructure​(StormTopology topology)` |

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

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

- - ### Field Detail

    - #### SYSTEM_STREAM_ID

          public static final String SYSTEM_STREAM_ID

      See Also:
        Constant Field Values

    - #### EVENTLOGGER_COMPONENT_ID

          public static final String EVENTLOGGER_COMPONENT_ID

      See Also:
        Constant Field Values

    - #### EVENTLOGGER_STREAM_ID

          public static final String EVENTLOGGER_STREAM_ID

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_CLASS

          public static final String TOPOLOGY_METRICS_CONSUMER_CLASS

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_ARGUMENT

          public static final String TOPOLOGY_METRICS_CONSUMER_ARGUMENT

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_MAX_RETAIN_METRIC_TUPLES

          public static final String TOPOLOGY_METRICS_CONSUMER_MAX_RETAIN_METRIC_TUPLES

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_PARALLELISM_HINT

          public static final String TOPOLOGY_METRICS_CONSUMER_PARALLELISM_HINT

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_WHITELIST

          public static final String TOPOLOGY_METRICS_CONSUMER_WHITELIST

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_BLACKLIST

          public static final String TOPOLOGY_METRICS_CONSUMER_BLACKLIST

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_EXPAND_MAP_TYPE

          public static final String TOPOLOGY_METRICS_CONSUMER_EXPAND_MAP_TYPE

      See Also:
        Constant Field Values

    - #### TOPOLOGY_METRICS_CONSUMER_METRIC_NAME_SEPARATOR

          public static final String TOPOLOGY_METRICS_CONSUMER_METRIC_NAME_SEPARATOR

      See Also:
        Constant Field Values

    - #### TOPOLOGY_EVENT_LOGGER_CLASS

          public static final String TOPOLOGY_EVENT_LOGGER_CLASS

      See Also:
        Constant Field Values

    - #### TOPOLOGY_EVENT_LOGGER_ARGUMENTS

          public static final String TOPOLOGY_EVENT_LOGGER_ARGUMENTS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### StormCommon

          public StormCommon()

  - ### Method Detail

    - #### setInstance

          public static StormCommon setInstance​(StormCommon common)

      Provide an instance of this class for delegates to use. To mock out delegated methods, provide an instance of a subclass that overrides the implementation of the delegated method.
      Parameters:
        `common` - a StormCommon instance
      Returns:
        the previously set instance

    - #### validateDistributedMode

          public static void validateDistributedMode​(Map<String,​Object> conf)

    - #### allComponents

          public static Map<String,​Object> allComponents​(StormTopology topology)

    - #### componentConf

          public static Map<String,​Object> componentConf​(Object component)

    - #### validateBasic

          public static void validateBasic​(StormTopology topology)
                                    throws InvalidTopologyException

      Throws:
        `InvalidTopologyException`

    - #### validateStructure

          public static void validateStructure​(StormTopology topology)
                                        throws InvalidTopologyException

      Throws:
        `InvalidTopologyException`

    - #### ackerInputs

          public static Map<GlobalStreamId,​Grouping> ackerInputs​(StormTopology topology)

    - #### makeAckerBolt

          public static IBolt makeAckerBolt()

    - #### addAcker

          public static void addAcker​(Map<String,​Object> conf,
                                      StormTopology topology)

    - #### getComponentCommon

          public static ComponentCommon getComponentCommon​(Object component)

    - #### addMetricStreams

          public static void addMetricStreams​(StormTopology topology)

    - #### addSystemStreams

          public static void addSystemStreams​(StormTopology topology)

    - #### eventLoggerBoltFields

          public static List<String> eventLoggerBoltFields()

    - #### eventLoggerInputs

          public static Map<GlobalStreamId,​Grouping> eventLoggerInputs​(StormTopology topology)

    - #### addEventLogger

          public static void addEventLogger​(Map<String,​Object> conf,
                                            StormTopology topology)

    - #### metricsConsumerBoltSpecs

          public static Map<String,​Bolt> metricsConsumerBoltSpecs​(Map<String,​Object> conf,
                                                                        StormTopology topology)

    - #### addMetricComponents

          public static void addMetricComponents​(Map<String,​Object> conf,
                                                 StormTopology topology)

    - #### addSystemComponents

          public static void addSystemComponents​(Map<String,​Object> conf,
                                                 StormTopology topology)

    - #### systemTopology

          public static StormTopology systemTopology​(Map<String,​Object> topoConf,
                                                     StormTopology topology)
                                              throws InvalidTopologyException

      Construct a new topology structure after adding system components and streams. WARNING: while changing the existing code to add or remove streams for a component is allowed, please be aware that it might cause issues during cluster rolling upgrade because `SerializationFactory.IdDictionary` depends on having a consistent map of component to streams to work properly (see STORM-3687 for an example). It will not impact a cluster running on a single version or running an older topology on a newer cluster. But a mixed cluster (with different versions of daemons running) is not guaranteed to work.
      Parameters:
        `topoConf` - the topology configuration
        `topology` - the original topology structure
      Returns:
        the newly constructed topology
      Throws:
        `InvalidTopologyException` - if the topology is invalid

    - #### hasAckers

          public static boolean hasAckers​(Map<String,​Object> topoConf)

    - #### hasEventLoggers

          public static boolean hasEventLoggers​(Map<String,​Object> topoConf)

    - #### numStartExecutors

          public static int numStartExecutors​(Object component)
                                       throws InvalidTopologyException

      Throws:
        `InvalidTopologyException`

    - #### stormTaskInfo

          public static Map<Integer,​String> stormTaskInfo​(StormTopology userTopology,
                                                                Map<String,​Object> topoConf)
                                                         throws InvalidTopologyException

      Throws:
        `InvalidTopologyException`

    - #### executorIdToTasks

          public static List<Integer> executorIdToTasks​(List<Long> executorId)

    - #### taskToNodeport

          public static Map<Integer,​NodeInfo> taskToNodeport​(Map<List<Long>,​NodeInfo> executorToNodePort)

    - #### mkAuthorizationHandler

          public static IAuthorizer mkAuthorizationHandler​(String klassName,
                                                           Map<String,​Object> conf)
                                                    throws IllegalAccessException,
                                                           InstantiationException,
                                                           ClassNotFoundException

      Throws:
        `IllegalAccessException`
        `InstantiationException`
        `ClassNotFoundException`

    - #### makeWorkerContext

          public static WorkerTopologyContext makeWorkerContext​(Map<String,​Object> workerData)

    - #### makeAckerBoltImpl

          public IBolt makeAckerBoltImpl()

    - #### systemTopologyImpl

          protected StormTopology systemTopologyImpl​(Map<String,​Object> topoConf,
                                                     StormTopology topology)
                                              throws InvalidTopologyException

      Throws:
        `InvalidTopologyException`

    - #### stormTaskInfoImpl

          protected Map<Integer,​String> stormTaskInfoImpl​(StormTopology userTopology,
                                                                Map<String,​Object> topoConf)
                                                         throws InvalidTopologyException

      Throws:
        `InvalidTopologyException`

    - #### mkAuthorizationHandlerImpl

          protected IAuthorizer mkAuthorizationHandlerImpl​(String klassName,
                                                           Map<String,​Object> conf)
                                                    throws ClassNotFoundException,
                                                           IllegalAccessException,
                                                           InstantiationException

      Throws:
        `ClassNotFoundException`
        `IllegalAccessException`
        `InstantiationException`