Package org.omnifaces.utils.properties
Class PropertiesUtils
- java.lang.Object
-
- org.omnifaces.utils.properties.PropertiesUtils
-
public final class PropertiesUtils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PropertiesUtils.PropertiesFormat
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getEarBaseUrl()
static String
getStage(String stageSystemPropertyName, String defaultStage)
static void
loadListFromUrl(String url, Map<? super String,? super String> settings)
static void
loadListFromURL(URL url, Map<? super String,? super String> settings)
static Map<String,String>
loadPropertiesFromClasspath(String baseName)
static void
loadPropertiesFromStream(InputStream in, String locationDescription, Map<? super String,? super String> settings, PropertiesUtils.PropertiesFormat propertiesFormat)
static void
loadPropertiesFromUrl(String url, Map<? super String,? super String> settings, PropertiesUtils.PropertiesFormat propertiesFormat)
static void
loadPropertiesFromUrl(URL url, Map<? super String,? super String> settings, PropertiesUtils.PropertiesFormat propertiesFormat)
static Map<String,String>
loadPropertiesListStagedFromClassPath(String fileName, String stageSystemPropertyName, String defaultStage)
Loads the properties file in properties list format with the given name from the configuration directory of META-INF with support for staging.static Map<String,String>
loadPropertiesListStagedFromEar(String fileName, String stageSystemPropertyName)
Loads the properties file in properties list format with the given name from the configuration directory of an EAR with support for staging.static Map<String,String>
loadStagedFromClassPath(BiConsumer<URL,Map<? super String,? super String>> loadMethod, String fileName, String stageSystemPropertyName, String defaultStage)
static Map<String,String>
loadStagedFromEar(BiConsumer<String,Map<? super String,? super String>> loadMethod, String fileName, String stageSystemPropertyName)
static void
loadXMLFromUrl(String url, Map<? super String,? super String> settings)
static void
loadXMLFromURL(URL url, Map<? super String,? super String> settings)
static Map<String,String>
loadXMLPropertiesStagedFromClassPath(String fileName, String stageSystemPropertyName, String defaultStage)
Loads the properties file in XML format with the given name from the configuration directory of META-INF with support for staging.static Map<String,String>
loadXMLPropertiesStagedFromEar(String fileName, String stageSystemPropertyName)
Loads the properties file in XML format with the given name from the configuration directory of an EAR with support for staging.
-
-
-
Method Detail
-
loadPropertiesFromClasspath
public static Map<String,String> loadPropertiesFromClasspath(String baseName)
-
loadPropertiesListStagedFromClassPath
public static Map<String,String> loadPropertiesListStagedFromClassPath(String fileName, String stageSystemPropertyName, String defaultStage)
Loads the properties file in properties list format with the given name from the configuration directory of META-INF with support for staging. The properties will loaded from the default properties file and the properties file from the given stage. If both files contain properties with the same key, the returned Map object will only contain the stage specific ones.- Parameters:
fileName
- the file name of the properties filestageSystemPropertyName
- the name of the system property from which the stage is readdefaultStage
- the default stage- Returns:
- an immutable map instance containing the key/value pairs from the given file
-
loadXMLPropertiesStagedFromClassPath
public static Map<String,String> loadXMLPropertiesStagedFromClassPath(String fileName, String stageSystemPropertyName, String defaultStage)
Loads the properties file in XML format with the given name from the configuration directory of META-INF with support for staging. The properties will loaded from the default properties file and the properties file from the given stage. If both files contain properties with the same key, the returned Map object will only contain the stage specific ones.- Parameters:
fileName
- the file name of the properties filestageSystemPropertyName
- the name of the system property from which the stage is readdefaultStage
- the default stage- Returns:
- an immutable map instance containing the key/value pairs from the given file
-
loadStagedFromClassPath
public static Map<String,String> loadStagedFromClassPath(BiConsumer<URL,Map<? super String,? super String>> loadMethod, String fileName, String stageSystemPropertyName, String defaultStage)
-
loadPropertiesListStagedFromEar
public static Map<String,String> loadPropertiesListStagedFromEar(String fileName, String stageSystemPropertyName)
Loads the properties file in properties list format with the given name from the configuration directory of an EAR with support for staging. The properties will loaded from the default properties file and the properties file from the given stage. If both files contain properties with the same key, the returned Map object will only contain the stage specific ones.- Parameters:
fileName
- the file name of the properties filestageSystemPropertyName
- the name of the system property from which the stage is read- Returns:
- an immutable map instance containing the key/value pairs from the given file
-
loadXMLPropertiesStagedFromEar
public static Map<String,String> loadXMLPropertiesStagedFromEar(String fileName, String stageSystemPropertyName)
Loads the properties file in XML format with the given name from the configuration directory of an EAR with support for staging. The properties will loaded from the default properties file and the properties file from the given stage. If both files contain properties with the same key, the returned Map object will only contain the stage specific ones.- Parameters:
fileName
- the file name of the properties filestageSystemPropertyName
- the name of the system property from which the stage is read- Returns:
- an immutable map instance containing the key/value pairs from the given file
-
loadStagedFromEar
public static Map<String,String> loadStagedFromEar(BiConsumer<String,Map<? super String,? super String>> loadMethod, String fileName, String stageSystemPropertyName)
-
getEarBaseUrl
public static String getEarBaseUrl()
-
loadListFromUrl
public static void loadListFromUrl(String url, Map<? super String,? super String> settings)
-
loadXMLFromUrl
public static void loadXMLFromUrl(String url, Map<? super String,? super String> settings)
-
loadListFromURL
public static void loadListFromURL(URL url, Map<? super String,? super String> settings)
-
loadXMLFromURL
public static void loadXMLFromURL(URL url, Map<? super String,? super String> settings)
-
loadPropertiesFromUrl
public static void loadPropertiesFromUrl(String url, Map<? super String,? super String> settings, PropertiesUtils.PropertiesFormat propertiesFormat)
-
loadPropertiesFromUrl
public static void loadPropertiesFromUrl(URL url, Map<? super String,? super String> settings, PropertiesUtils.PropertiesFormat propertiesFormat)
-
loadPropertiesFromStream
public static void loadPropertiesFromStream(InputStream in, String locationDescription, Map<? super String,? super String> settings, PropertiesUtils.PropertiesFormat propertiesFormat)
-
-