Package 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 Description static String
FILE_SEPARATOR
static String
RESOURCES_SUBDIR
static String
STORM_HOME
-
Constructor Summary
Constructors Constructor Description ConfigUtils()
-
Method Summary
-
-
-
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
-
-
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
-
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, String id, Integer port)
-
getLogDir
public static String getLogDir()
-
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
-
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
-
readSupervisorStormCodeGivenPath
public static StormTopology readSupervisorStormCodeGivenPath(String stormCodePath, AdvancedFSOps ops) throws IOException
- Throws:
IOException
-
workerArtifactsSymlink
public static String workerArtifactsSymlink(Map<String,Object> conf, String id)
-
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
-
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.
-
supervisorLocalDir
public static String supervisorLocalDir(Map<String,Object> conf) throws IOException
- Throws:
IOException
-
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 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
-
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
-
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
-
-