Class ConfigurationHolder


  • public class ConfigurationHolder
    extends Object
    Class used to hold the configuration for Nuxeo.
    Since:
    11.5
    • Field Detail

      • DB_LIST

        protected static final List<String> DB_LIST
      • DIRECTORY_PARAMETERS

        protected static final Set<String> DIRECTORY_PARAMETERS
      • LOG4J2_CONF

        protected static final Path LOG4J2_CONF
      • NXSERVER

        protected static final Path NXSERVER
      • TEMPLATES

        protected static final Path TEMPLATES
      • home

        protected final Path home
        Path representing the Nuxeo Server home directory. Usually /opt/nuxeo/server.
      • nuxeoConf

        protected final Path nuxeoConf
        Path representing the Nuxeo Server configuration file. Usually /opt/nuxeo/server/bin/nuxeo.conf.
      • defaultConfig

        protected final Properties defaultConfig
        Properties representing concatenation of templates/nuxeo.defaults, System.getProperties() and nuxeo.defaults from each template.
      • templates

        protected final List<Path> templates
        Templates included in this configuration.
    • Constructor Detail

      • ConfigurationHolder

        public ConfigurationHolder​(Path home,
                                   Path nuxeoConf)
    • Method Detail

      • getHomePath

        public Path getHomePath()
      • getNuxeoConfPath

        public Path getNuxeoConfPath()
      • getTemplatesPath

        public Path getTemplatesPath()
      • getRuntimeHomePath

        public Path getRuntimeHomePath()
        Returns the Home of NuxeoRuntime (same as Framework.getRuntime().getHome()).
      • getConfigurationPath

        public Path getConfigurationPath()
      • getDataPath

        public Path getDataPath()
      • getDumpedConfigurationPath

        public Path getDumpedConfigurationPath()
      • getLogPath

        public Path getLogPath()
      • getLogConfigPath

        public Path getLogConfigPath()
      • getPackagesPath

        protected Path getPackagesPath()
      • getPidDirPath

        public Path getPidDirPath()
      • getTmpPath

        public Path getTmpPath()
      • isLoaded

        public boolean isLoaded()
      • getDefaultProperty

        public String getDefaultProperty​(String key)
        Returns the property value associated with the given key from the default configuration.
      • getProperty

        public String getProperty​(String key)
        Returns the property value associated with the given key from the user configuration.

        The method falls back on the default configuration if the user configuration doesn't contain a property value associated with the given key.

      • getProperty

        public String getProperty​(String key,
                                  String defaultValue)
        Returns the property value associated with the given key from the user configuration.

        The method falls back on the default configuration if the user configuration doesn't contain a property value associated with the given key, then falls back on the given defaultValue if the default configuration doesn't contain a property value associated with then key.

      • getOptProperty

        public Optional<String> getOptProperty​(String key)
        Returns the property value associated with the given key from the user configuration.
      • getPropertyAsBoolean

        public boolean getPropertyAsBoolean​(String key)
        Returns the property value as a boolean associated with the given key from the user configuration.
      • getPropertyAsInteger

        public int getPropertyAsInteger​(String key,
                                        int defaultValue)
        Returns the property value as an int associated with the given key from the user configuration.
        Throws:
        NumberFormatException - – if the string does not contain a parsable integer
      • getPropertyAsPath

        public Path getPropertyAsPath​(String key)
        Returns the property value as a Path associated with the given key from the user configuration.
        Throws:
        InvalidPathException - – if the path string cannot be converted to a Path
      • getRawProperty

        public String getRawProperty​(String key)
        Returns the raw property value associated with the given key from the user configuration.
      • isForceGenerationOnce

        public boolean isForceGenerationOnce()
      • isForceGeneration

        public boolean isForceGeneration()
      • putDefault

        public String putDefault​(String key,
                                 String value)
        Puts the given property into default configuration.
      • putDefaultAll

        public void putDefaultAll​(Properties properties)
        Puts all given properties into default configuration.
      • put

        public String put​(String key,
                          String value)
        Puts the given property into user configuration.
      • putAll

        public void putAll​(Properties properties)
        Puts all given properties into user configuration.
      • putTemplateAll

        public void putTemplateAll​(Path template,
                                   Properties properties)
        Puts all given properties into default configuration for the given template.
      • getIncludedTemplates

        public List<Path> getIncludedTemplates()
        Returns:
        the absolute Paths of the included templates
      • getIncludedTemplateNames

        public List<String> getIncludedTemplateNames()
        Returns:
        the names of the included templates (ie: name of template directory)
      • getIncludedDBTemplateName

        public String getIncludedDBTemplateName()
        Returns:
        the name of the included DB template
      • instantiateTemplateParser

        public TextTemplate instantiateTemplateParser()
        Since:
        2021.14
      • clear

        protected void clear()