Class PropertiesUtils


  • public final class PropertiesUtils
    extends Object
    • 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 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
      • 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
      • 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)
      • getStage

        public static String getStage​(String stageSystemPropertyName,
                                      String defaultStage)