public final class ConfigUtils
extends java.lang.Object
The central config folder is determined in this order from the first non-blank location (the last will always succeed!)
‑Dorg.eclipse.smila.utils.config.root=<path> org.eclipse.smila.utils.config.root=<path> <org.eclipse.core.runtime.Platform.getInstallLocation()>/configuration.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_CONFIG_ROOT
The Constant PROPERTY_CONFIG_ROOT.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getConfigContent(java.lang.String bundleName,
java.lang.String configPath)
gets content of an configuration file as a string, assuming UTF-8 as the encoding.
|
static java.util.List<java.lang.String> |
getConfigEntries(java.lang.String bundleName,
java.lang.String configPath)
Gets the files.
|
static java.io.File |
getConfigFile(java.lang.String bundleName,
java.lang.String configPath)
Gets the config file as denoted by the given arguments, or null if it doesnt exist.
|
static java.io.File |
getConfigFilePath(java.lang.String bundleName,
java.lang.String configPath)
Gets the File object denoting the path as defined by the given arguments.
|
static java.io.File |
getConfigFolder(java.lang.String bundleName,
java.lang.String configPath)
Deprecated.
use the more correctly named
getConfigFile(String, String) as this may also return
non-directory entries. |
static java.util.Properties |
getConfigProperties(java.lang.String bundleName,
java.lang.String configPath)
Gets the config properties.
|
static java.io.InputStream |
getConfigStream(java.lang.String bundleName,
java.lang.String configPath)
Gets the configuration stream.
|
static java.io.InputStream |
getConfigStream(java.lang.String bundleName,
java.lang.String configPath,
java.lang.String defaultConfigPath)
Gets the configuration stream for the denoted config file.
|
static java.io.File |
getConfigurationFolder()
Gets the root configuration folder as set thru the env var/system propery "org.eclipse.smila.utils.config.root".
|
public static final java.lang.String PROPERTY_CONFIG_ROOT
public static java.io.InputStream getConfigStream(java.lang.String bundleName,
java.lang.String configPath,
java.lang.String defaultConfigPath)
Note: While this methods supports the bundle name to be an arbitrary string that is not the name of the bundle for "normal" configs the defaultConfigPath will only work if the given bundle name is actually the name of the bundle.
bundleName - the bundle nameconfigPath - the path which may be either relative or absolute. defaultConfigPath - the default config path to a resource that is contained in the bundle itself if the configPath doesnt
resolve to an existing file.ConfigurationLoadException - if the denoted config file doesnt exist or cannot be opened.@Deprecated
public static java.io.File getConfigFolder(java.lang.String bundleName,
java.lang.String configPath)
getConfigFile(String, String) as this may also return
non-directory entries.bundleName - the bundle nameconfigPath - the configuration namepublic static java.io.File getConfigFile(java.lang.String bundleName,
java.lang.String configPath)
bundleName - the bundle nameconfigPath - the config pathgetConfigFilePath(String, String)public static java.io.File getConfigFilePath(java.lang.String bundleName,
java.lang.String configPath)
bundleName - the bundle nameconfigPath - the config pathpublic static java.io.InputStream getConfigStream(java.lang.String bundleName,
java.lang.String configPath)
bundleName - the bundle nameconfigPath - the configuration pathpublic static java.util.List<java.lang.String> getConfigEntries(java.lang.String bundleName,
java.lang.String configPath)
bundleName - the bundle nameconfigPath - the config namepublic static java.io.File getConfigurationFolder()
public static java.util.Properties getConfigProperties(java.lang.String bundleName,
java.lang.String configPath)
throws java.io.IOException
java.io.IOException#getConfigStream(String, String)} as it is called.public static java.lang.String getConfigContent(java.lang.String bundleName,
java.lang.String configPath)
throws java.io.IOException
java.io.IOException#getConfigStream(String, String)} as it is called.