Package org.apache.storm.utils
Class ConfigUtils
java.lang.Object
org.apache.storm.utils.ConfigUtils
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
ConfigUtilspublic ConfigUtils()
 
- 
- 
Method Details- 
setInstanceProvide 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
- 
readDirContentsReturns a Collection of file names found under the given directory.- Parameters:
- dir- a directory
- Returns:
- the Collection of file names
 
- 
readDirFilesReturns 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
- 
readSupervisorTopologypublic static StormTopology readSupervisorTopology(Map<String, Object> conf, String stormId, AdvancedFSOps ops) throws IOException- Throws:
- IOException
 
- 
supervisorStormCodePath
- 
concatIfNotNull
- 
supervisorStormDistRoot- Throws:
- IOException
 
- 
supervisorStormDistRootpublic static String supervisorStormDistRoot(Map<String, Object> conf, String stormId) throws IOException- Throws:
- IOException
 
- 
supervisorStormJarPath
- 
supervisorStormConfPath
- 
absoluteStormLocalDir
- 
absoluteStormBlobStoreDir
- 
readSupervisorStormCodeGivenPathpublic static StormTopology readSupervisorStormCodeGivenPath(String stormCodePath, AdvancedFSOps ops) throws IOException - Throws:
- IOException
 
- 
supervisorStormResourcesPath
- 
workerRoot
- 
workerRoot
- 
workerArtifactsSymlink
- 
workerPidsRoot
- 
workerPidPath
- 
workerPidPath
- 
workerArtifactsPidPath
- 
readSupervisorStormConfpublic static Map<String,Object> readSupervisorStormConf(Map<String, Object> conf, String stormId) throws IOException- Throws:
- IOException
 
- 
readSupervisorStormConfGivenPathpublic static Map<String,Object> readSupervisorStormConfGivenPath(Map<String, Object> conf, String topoConfPath) throws IOException- Throws:
- IOException
 
- 
overrideLoginConfigWithSystemProperty
- 
workerHeartbeatsRoot
- 
workerState- Throws:
- IOException
 
- 
masterStormCodeKey
- 
masterStormConfKey
- 
getIdFromBlobKeyReturns 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
- 
getValueAsListGet 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
 
- 
readSupervisorTopologyImplpublic StormTopology readSupervisorTopologyImpl(Map<String, Object> conf, String stormId, AdvancedFSOps ops) throws IOException- Throws:
- IOException
 
- 
readStormConfigImpl
- 
workerArtifactsRootImpl
- 
supervisorStormDistRootImplpublic String supervisorStormDistRootImpl(Map<String, Object> conf, String stormId) throws IOException- Throws:
- IOException
 
- 
supervisorStormDistRootImpl- Throws:
- IOException
 
- 
workerRootImpl
- 
readSupervisorStormConfImplpublic Map<String,Object> readSupervisorStormConfImpl(Map<String, Object> conf, String stormId) throws IOException- Throws:
- IOException
 
- 
supervisorLocalDirImpl- Throws:
- IOException
 
 
-