Class AppInitPropertiesService

java.lang.Object
fr.paris.lutece.util.AppInitPropertiesService

public final class AppInitPropertiesService extends Object
This class provides management services for properties files.

The configuration is split into two independent sources :

  • a base source holding every .properties file except those located under the override/ and override/plugins directories ;
  • an override source holding only the .properties files located under the override/ and override/plugins directories.

Each source is exposed to MicroProfile Config through a dedicated ConfigSource, the override source being given a higher ordinal so that its values take precedence over the base ones.

  • Method Details

    • init

      public static void init(String strConfPath)
      Initializes the base and the override properties services.
      Parameters:
      strConfPath - The configuration path
    • getBaseProperty

      public static String getBaseProperty(String strProperty)
      Returns the value of a variable defined in the base properties files (everything except the override directories) as a String.
      Parameters:
      strProperty - The variable name
      Returns:
      The variable value read in the base properties files
    • getBasePropertiesName

      public static Set<String> getBasePropertiesName()
      Returns the names of the variables defined in the base properties files (everything except the override directories).
      Returns:
      The set of base property names
    • getOverrideProperty

      public static String getOverrideProperty(String strProperty)
      Returns the value of a variable defined in the override properties files (override/ and override/plugins) as a String.
      Parameters:
      strProperty - The variable name
      Returns:
      The variable value read in the override properties files
    • getOverridePropertiesName

      public static Set<String> getOverridePropertiesName()
      Returns the names of the variables defined in the override properties files (override/ and override/plugins).
      Returns:
      The set of override property names
    • getProperty

      public static String getProperty(String strProperty)
      Returns the value of a variable defined in the .properties files of the application as a String. The override source takes precedence over the base source.
      Parameters:
      strProperty - The variable name
      Returns:
      The variable value read in the properties files
    • getProperties

      public static Properties getProperties()
      Gets all properties, merging the base and the override sources, the override values taking precedence.
      Returns:
      All properties
      Since:
      version 3.0
    • getPropertiesAsMap

      public static Map<String,String> getPropertiesAsMap()
      Get all properties As map
      Returns:
      Properties as map
    • getPropertiesName

      public static Set<String> getPropertiesName()
      Return the union of the base and the override property names.
      Returns:
      The set of all property names
    • getKeys

      public static List<String> getKeys(String strPrefix)
      Returns a list of keys that match a given prefix.
      Parameters:
      strPrefix - the str prefix
      Returns:
      A list of keys that match the prefix
      Since:
      version 7.0