Class PropertiesUtils

java.lang.Object
org.omnifaces.utils.properties.PropertiesUtils

public final class PropertiesUtils extends Object
  • Method Details

    • 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 file
      stageSystemPropertyName - the name of the system property from which the stage is read
      defaultStage - 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 file
      stageSystemPropertyName - the name of the system property from which the stage is read
      defaultStage - 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 file
      stageSystemPropertyName - 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 file
      stageSystemPropertyName - 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)
    • getStage

      public static String getStage(String stageSystemPropertyName, String defaultStage)