org.apache.storm.utils

## Class ConfigUtils

- java.lang.Object
- - org.apache.storm.utils.ConfigUtils

-     public class ConfigUtils
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `FILE_SEPARATOR`
    `static String` | `RESOURCES_SUBDIR`
    `static String` | `STORM_HOME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfigUtils()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `absoluteStormBlobStoreDir(Map<String,Object> conf)`
    `static String` | `absoluteStormLocalDir(Map<String,Object> conf)`
    `static String` | `concatIfNotNull(String dir)`
    `static BooleanSupplier` | `evenSampler(int samplingFreq)`
    `static String` | `getIdFromBlobKey(String key)` Returns the topology ID belonging to a blob key if it exists.
    `static String` | `getLogDir()`
    `static List<String>` | `getValueAsList(String name, Map<String,Object> conf)` Get the given config value as a List <String>, if possible.
    `static File` | `getWorkerDirFromRoot(String logRoot, String id, Integer port)`
    `static boolean` | `isLocalMode(Map<String,Object> conf)`
    `static Map<String,Object>` | `maskPasswords(Map<String,Object> conf)`
    `static String` | `masterStormCodeKey(String topologyId)`
    `static String` | `masterStormConfKey(String topologyId)`
    `static String` | `masterStormJarKey(String topologyId)`
    `static BooleanSupplier` | `mkStatsSampler(Map<String,Object> conf)`
    `static Map<String,Object>` | `overrideLoginConfigWithSystemProperty(Map<String,Object> conf)`
    `static Collection<String>` | `readDirContents(String dir)` Returns a Collection of file names found under the given directory.
    `static Collection<File>` | `readDirFiles(String dir)` Returns a Collection of files found under the given directory.
    `static Map<String,Object>` | `readStormConfig()`
    `Map<String,Object>` | `readStormConfigImpl()`
    `static StormTopology` | `readSupervisorStormCodeGivenPath(String stormCodePath, AdvancedFSOps ops)`
    `static Map<String,Object>` | `readSupervisorStormConf(Map<String,Object> conf, String stormId)`
    `static Map<String,Object>` | `readSupervisorStormConfGivenPath(Map<String,Object> conf, String topoConfPath)`
    `Map<String,Object>` | `readSupervisorStormConfImpl(Map<String,Object> conf, String stormId)`
    `static StormTopology` | `readSupervisorTopology(Map<String,Object> conf, String stormId, AdvancedFSOps ops)`
    `StormTopology` | `readSupervisorTopologyImpl(Map<String,Object> conf, String stormId, AdvancedFSOps ops)`
    `static Map<String,Object>` | `readYamlConfig(String name)`
    `static Map<String,Object>` | `readYamlConfig(String name, boolean mustExist)`
    `static int` | `samplingRate(Map<String,Object> conf)`
    `static ConfigUtils` | `setInstance(ConfigUtils u)` Provide an instance of this class for delegates to use.
    `static String` | `sharedByTopologyDir(Map<String,Object> conf, String stormId)`
    `static String` | `stormDistPath(String stormRoot)`
    `static String` | `supervisorLocalDir(Map<String,Object> conf)`
    `String` | `supervisorLocalDirImpl(Map<String,Object> conf)`
    `static String` | `supervisorStormCodePath(String stormRoot)`
    `static String` | `supervisorStormConfPath(String stormRoot)`
    `static String` | `supervisorStormDistRoot(Map<String,Object> conf)`
    `static String` | `supervisorStormDistRoot(Map<String,Object> conf, String stormId)`
    `String` | `supervisorStormDistRootImpl(Map<String,Object> conf)`
    `String` | `supervisorStormDistRootImpl(Map<String,Object> conf, String stormId)`
    `static String` | `supervisorStormJarPath(String stormRoot)`
    `static String` | `supervisorStormResourcesPath(String stormRoot)`
    `static String` | `workerArtifactsPidPath(Map<String,Object> conf, String id, Integer port)`
    `static String` | `workerArtifactsRoot(Map<String,Object> conf)`
    `static String` | `workerArtifactsRoot(Map<String,Object> conf, String id)`
    `static String` | `workerArtifactsRoot(Map<String,Object> conf, String id, Integer port)`
    `String` | `workerArtifactsRootImpl(Map<String,Object> conf)`
    `static String` | `workerArtifactsSymlink(Map<String,Object> conf, String id)`
    `static String` | `workerHeartbeatsRoot(Map<String,Object> conf, String id)`
    `static String` | `workerPidPath(Map<String,Object> conf, String id, long pid)`
    `static String` | `workerPidPath(Map<String,Object> conf, String id, String pid)`
    `static String` | `workerPidsRoot(Map<String,Object> conf, String id)`
    `static String` | `workerRoot(Map<String,Object> conf)`
    `static String` | `workerRoot(Map<String,Object> conf, String id)`
    `String` | `workerRootImpl(Map<String,Object> conf)`
    `static LocalState` | `workerState(Map<String,Object> conf, String id)`
    `static String` | `workerTmpRoot(Map<String,Object> conf, String id)`
    `static String` | `workerUserFile(Map<String,Object> conf, String workerId)`
    `static String` | `workerUserRoot(Map<String,Object> conf)`

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

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

- - ### Field Detail

    - #### FILE_SEPARATOR

          public static final String FILE_SEPARATOR

    - #### STORM_HOME

          public static final String STORM_HOME

      See Also:
        Constant Field Values

    - #### RESOURCES_SUBDIR

          public static final String RESOURCES_SUBDIR

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ConfigUtils

          public ConfigUtils()

  - ### Method Detail

    - #### setInstance

          public static ConfigUtils setInstance(ConfigUtils u)

      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:
        `u` - a ConfigUtils instance
      Returns:
        the previously set instance

    - #### maskPasswords

          public static Map<String,Object> maskPasswords(Map<String,Object> conf)

    - #### isLocalMode

          public static boolean isLocalMode(Map<String,Object> conf)

    - #### readDirContents

          public static Collection<String> readDirContents(String dir)

      Returns a Collection of file names found under the given directory.

      Parameters:
        `dir` - a directory
      Returns:
        the Collection of file names

    - #### readDirFiles

          public static Collection<File> readDirFiles(String dir)

      Returns a Collection of files found under the given directory.

      Parameters:
        `dir` - a directory
      Returns:
        the Collection of file names

    - #### workerArtifactsRoot

          public static String workerArtifactsRoot(Map<String,Object> conf)

    - #### workerArtifactsRoot

          public static String workerArtifactsRoot(Map<String,Object> conf,
                                                   String id)

    - #### workerArtifactsRoot

          public static String workerArtifactsRoot(Map<String,Object> conf,
                                                   String id,
                                                   Integer port)

    - #### getLogDir

          public static String getLogDir()

    - #### readStormConfig

          public static Map<String,Object> readStormConfig()

    - #### samplingRate

          public static int samplingRate(Map<String,Object> conf)

    - #### mkStatsSampler

          public static BooleanSupplier mkStatsSampler(Map<String,Object> conf)

    - #### evenSampler

          public static BooleanSupplier evenSampler(int samplingFreq)

    - #### readSupervisorTopology

          public static StormTopology readSupervisorTopology(Map<String,Object> conf,
                                                             String stormId,
                                                             AdvancedFSOps ops)
                                                      throws IOException

      Throws:
        `IOException`

    - #### supervisorStormCodePath

          public static String supervisorStormCodePath(String stormRoot)

    - #### concatIfNotNull

          public static String concatIfNotNull(String dir)

    - #### supervisorStormDistRoot

          public static String supervisorStormDistRoot(Map<String,Object> conf)
                                                throws IOException

      Throws:
        `IOException`

    - #### supervisorStormDistRoot

          public static String supervisorStormDistRoot(Map<String,Object> conf,
                                                       String stormId)
                                                throws IOException

      Throws:
        `IOException`

    - #### sharedByTopologyDir

          public static String sharedByTopologyDir(Map<String,Object> conf,
                                                   String stormId)
                                            throws IOException

      Throws:
        `IOException`

    - #### supervisorStormJarPath

          public static String supervisorStormJarPath(String stormRoot)

    - #### supervisorStormConfPath

          public static String supervisorStormConfPath(String stormRoot)

    - #### absoluteStormLocalDir

          public static String absoluteStormLocalDir(Map<String,Object> conf)

    - #### absoluteStormBlobStoreDir

          public static String absoluteStormBlobStoreDir(Map<String,Object> conf)

    - #### readSupervisorStormCodeGivenPath

          public static StormTopology readSupervisorStormCodeGivenPath(String stormCodePath,
                                                                       AdvancedFSOps ops)
                                                                throws IOException

      Throws:
        `IOException`

    - #### supervisorStormResourcesPath

          public static String supervisorStormResourcesPath(String stormRoot)

    - #### workerRoot

          public static String workerRoot(Map<String,Object> conf)

    - #### workerRoot

          public static String workerRoot(Map<String,Object> conf,
                                          String id)

    - #### workerArtifactsSymlink

          public static String workerArtifactsSymlink(Map<String,Object> conf,
                                                      String id)

    - #### workerPidsRoot

          public static String workerPidsRoot(Map<String,Object> conf,
                                              String id)

    - #### workerPidPath

          public static String workerPidPath(Map<String,Object> conf,
                                             String id,
                                             String pid)

    - #### workerPidPath

          public static String workerPidPath(Map<String,Object> conf,
                                             String id,
                                             long pid)

    - #### workerArtifactsPidPath

          public static String workerArtifactsPidPath(Map<String,Object> conf,
                                                      String id,
                                                      Integer port)

    - #### readSupervisorStormConf

          public static Map<String,Object> readSupervisorStormConf(Map<String,Object> conf,
                                                                   String stormId)
                                                            throws IOException

      Throws:
        `IOException`

    - #### readSupervisorStormConfGivenPath

          public static Map<String,Object> readSupervisorStormConfGivenPath(Map<String,Object> conf,
                                                                            String topoConfPath)
                                                                     throws IOException

      Throws:
        `IOException`

    - #### overrideLoginConfigWithSystemProperty

          public static Map<String,Object> overrideLoginConfigWithSystemProperty(Map<String,Object> conf)

    - #### workerHeartbeatsRoot

          public static String workerHeartbeatsRoot(Map<String,Object> conf,
                                                    String id)

    - #### workerState

          public static LocalState workerState(Map<String,Object> conf,
                                               String id)
                                        throws IOException

      Throws:
        `IOException`

    - #### masterStormCodeKey

          public static String masterStormCodeKey(String topologyId)

    - #### masterStormConfKey

          public static String masterStormConfKey(String topologyId)

    - #### getIdFromBlobKey

          public static String getIdFromBlobKey(String key)

      Returns the topology ID belonging to a blob key if it exists.

      Parameters:
        `key` - the blob key
      Returns:
        the topology id belonging to the key if it can be inferred. Returns null otherwise.

    - #### masterStormJarKey

          public static String masterStormJarKey(String topologyId)

    - #### readYamlConfig

          public static Map<String,Object> readYamlConfig(String name,
                                                          boolean mustExist)

    - #### readYamlConfig

          public static Map<String,Object> readYamlConfig(String name)

    - #### stormDistPath

          public static String stormDistPath(String stormRoot)

    - #### supervisorLocalDir

          public static String supervisorLocalDir(Map<String,Object> conf)
                                           throws IOException

      Throws:
        `IOException`

    - #### workerTmpRoot

          public static String workerTmpRoot(Map<String,Object> conf,
                                             String id)

    - #### workerUserRoot

          public static String workerUserRoot(Map<String,Object> conf)

    - #### workerUserFile

          public static String workerUserFile(Map<String,Object> conf,
                                              String workerId)

    - #### getWorkerDirFromRoot

          public static File getWorkerDirFromRoot(String logRoot,
                                                  String id,
                                                  Integer port)

    - #### getValueAsList

          public static List<String> getValueAsList(String name,
                                                    Map<String,Object> conf)

      Get the given config value as a List <String>, if possible.

      Parameters:
        `name` -
        - the config key
        `conf` -
        - the config map
      Returns:
        - the config value converted to a List <String> if found, otherwise null.
      Throws:
        `IllegalArgumentException` - if conf is null
        `NullPointerException` - if name is null and the conf map doesn’t support null keys

    - #### readSupervisorTopologyImpl

          public StormTopology readSupervisorTopologyImpl(Map<String,Object> conf,
                                                          String stormId,
                                                          AdvancedFSOps ops)
                                                   throws IOException

      Throws:
        `IOException`

    - #### readStormConfigImpl

          public Map<String,Object> readStormConfigImpl()

    - #### workerArtifactsRootImpl

          public String workerArtifactsRootImpl(Map<String,Object> conf)

    - #### supervisorStormDistRootImpl

          public String supervisorStormDistRootImpl(Map<String,Object> conf,
                                                    String stormId)
                                             throws IOException

      Throws:
        `IOException`

    - #### supervisorStormDistRootImpl

          public String supervisorStormDistRootImpl(Map<String,Object> conf)
                                             throws IOException

      Throws:
        `IOException`

    - #### workerRootImpl

          public String workerRootImpl(Map<String,Object> conf)

    - #### readSupervisorStormConfImpl

          public Map<String,Object> readSupervisorStormConfImpl(Map<String,Object> conf,
                                                                String stormId)
                                                         throws IOException

      Throws:
        `IOException`

    - #### supervisorLocalDirImpl

          public String supervisorLocalDirImpl(Map<String,Object> conf)
                                        throws IOException

      Throws:
        `IOException`

Copyright © 2021 The Apache Software Foundation. All rights reserved.