Package org.apache.storm.utils
Class ConfigUtils
java.lang.Object
org.apache.storm.utils.ConfigUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringabsoluteStormBlobStoreDir(Map<String, Object> conf) static StringabsoluteStormLocalDir(Map<String, Object> conf) static StringconcatIfNotNull(String dir) static BooleanSupplierevenSampler(int samplingFreq) static StringgetIdFromBlobKey(String key) Returns the topology ID belonging to a blob key if it exists.static StringgetValueAsList(String name, Map<String, Object> conf) Get the given config value as a List <String>, if possible.static FilegetWorkerDirFromRoot(String logRoot, String id, Integer port) static booleanisLocalMode(Map<String, Object> conf) maskPasswords(Map<String, Object> conf) static StringmasterStormCodeKey(String topologyId) static StringmasterStormConfKey(String topologyId) static StringmasterStormJarKey(String topologyId) static BooleanSuppliermkStatsSampler(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 StormTopologyreadSupervisorStormCodeGivenPath(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 StormTopologyreadSupervisorTopology(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 intsamplingRate(Map<String, Object> conf) static ConfigUtilsProvide an instance of this class for delegates to use.static StringsharedByTopologyDir(Map<String, Object> conf, String stormId) static StringstormDistPath(String stormRoot) static StringsupervisorLocalDir(Map<String, Object> conf) supervisorLocalDirImpl(Map<String, Object> conf) static StringsupervisorStormCodePath(String stormRoot) static StringsupervisorStormConfPath(String stormRoot) static StringsupervisorStormDistRoot(Map<String, Object> conf) static StringsupervisorStormDistRoot(Map<String, Object> conf, String stormId) supervisorStormDistRootImpl(Map<String, Object> conf, String stormId) static StringsupervisorStormJarPath(String stormRoot) static StringsupervisorStormResourcesPath(String stormRoot) static Stringstatic StringworkerArtifactsRoot(Map<String, Object> conf) static StringworkerArtifactsRoot(Map<String, Object> conf, String id) static StringworkerArtifactsRootImpl(Map<String, Object> conf) static StringworkerArtifactsSymlink(Map<String, Object> conf, String id) static StringworkerHeartbeatsRoot(Map<String, Object> conf, String id) static StringworkerPidPath(Map<String, Object> conf, String id, long pid) static Stringstatic StringworkerPidsRoot(Map<String, Object> conf, String id) static StringworkerRoot(Map<String, Object> conf) static StringworkerRoot(Map<String, Object> conf, String id) workerRootImpl(Map<String, Object> conf) static LocalStateworkerState(Map<String, Object> conf, String id) static StringworkerTmpRoot(Map<String, Object> conf, String id) static StringworkerUserFile(Map<String, Object> conf, String workerId) static StringworkerUserRoot(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
-