Package org.apache.storm.utils
Class ConfigUtils
java.lang.Object
org.apache.storm.utils.ConfigUtils
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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) 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 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 StormTopology
readSupervisorStormCodeGivenPath
(String stormCodePath, AdvancedFSOps ops) readSupervisorStormConf
(Map<String, Object> conf, String stormId) readSupervisorStormConfGivenPath
(Map<String, Object> conf, String topoConfPath) readSupervisorStormConfImpl
(Map<String, Object> conf, String stormId) static StormTopology
readSupervisorTopology
(Map<String, Object> conf, String stormId, AdvancedFSOps ops) readSupervisorTopologyImpl
(Map<String, Object> conf, String stormId, AdvancedFSOps ops) readYamlConfig
(String name) readYamlConfig
(String name, boolean mustExist) static int
samplingRate
(Map<String, Object> conf) static ConfigUtils
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) 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) supervisorStormDistRootImpl
(Map<String, Object> conf, String stormId) static String
supervisorStormJarPath
(String stormRoot) static String
supervisorStormResourcesPath
(String stormRoot) static String
static String
workerArtifactsRoot
(Map<String, Object> conf) static String
workerArtifactsRoot
(Map<String, Object> conf, String id) static 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
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) 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)
-
Field Details
-
FILE_SEPARATOR
-
STORM_HOME
- See Also:
-
RESOURCES_SUBDIR
- See Also:
-
-
Constructor Details
-
ConfigUtils
public ConfigUtils()
-
-
Method Details
-
setInstance
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
-
isLocalMode
-
readDirContents
Returns a Collection of file names found under the given directory.- Parameters:
dir
- a directory- Returns:
- the Collection of file names
-
readDirFiles
Returns a Collection of files found under the given directory.- Parameters:
dir
- a directory- Returns:
- the Collection of file names
-
workerArtifactsRoot
-
workerArtifactsRoot
-
workerArtifactsRoot
-
getLogDir
-
readStormConfig
-
samplingRate
-
mkStatsSampler
-
evenSampler
-
readSupervisorTopology
public static StormTopology readSupervisorTopology(Map<String, Object> conf, String stormId, AdvancedFSOps ops) throws IOException- Throws:
IOException
-
supervisorStormCodePath
-
concatIfNotNull
-
supervisorStormDistRoot
- Throws:
IOException
-
supervisorStormDistRoot
public static String supervisorStormDistRoot(Map<String, Object> conf, String stormId) throws IOException- Throws:
IOException
-
supervisorStormJarPath
-
supervisorStormConfPath
-
absoluteStormLocalDir
-
absoluteStormBlobStoreDir
-
readSupervisorStormCodeGivenPath
public static StormTopology readSupervisorStormCodeGivenPath(String stormCodePath, AdvancedFSOps ops) throws IOException - Throws:
IOException
-
supervisorStormResourcesPath
-
workerRoot
-
workerRoot
-
workerArtifactsSymlink
-
workerPidsRoot
-
workerPidPath
-
workerPidPath
-
workerArtifactsPidPath
-
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
-
workerHeartbeatsRoot
-
workerState
- Throws:
IOException
-
masterStormCodeKey
-
masterStormConfKey
-
getIdFromBlobKey
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
-
readYamlConfig
-
readYamlConfig
-
stormDistPath
-
supervisorLocalDir
- Throws:
IOException
-
workerTmpRoot
-
workerUserRoot
-
workerUserFile
-
getWorkerDirFromRoot
-
getValueAsList
Get the given config value as a List <String>, if possible.- Parameters:
name
- - the config keyconf
- - the config map- Returns:
- - the config value converted to a List <String> if found, otherwise null.
- Throws:
IllegalArgumentException
- if conf is nullNullPointerException
- 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
-
workerArtifactsRootImpl
-
supervisorStormDistRootImpl
public String supervisorStormDistRootImpl(Map<String, Object> conf, String stormId) throws IOException- Throws:
IOException
-
supervisorStormDistRootImpl
- Throws:
IOException
-
workerRootImpl
-
readSupervisorStormConfImpl
public Map<String,Object> readSupervisorStormConfImpl(Map<String, Object> conf, String stormId) throws IOException- Throws:
IOException
-
supervisorLocalDirImpl
- Throws:
IOException
-