Package org.nuxeo.launcher.config
Class ConfigurationHolder
- java.lang.Object
-
- org.nuxeo.launcher.config.ConfigurationHolder
-
public class ConfigurationHolder extends Object
Class used to hold the configuration for Nuxeo.- Since:
- 11.5
-
-
Field Summary
Fields Modifier and Type Field Description protected static List<String>DB_LISTprotected PropertiesdefaultConfigProperties representing concatenation oftemplates/nuxeo.defaults,System.getProperties()andnuxeo.defaultsfrom each template.protected static Set<String>DIRECTORY_PARAMETERSprotected PathhomePath representing the Nuxeo Server home directory.protected static PathLOG4J2_CONFprotected PathnuxeoConfPath representing the Nuxeo Server configuration file.protected static PathNXSERVERprotected List<Path>templatesTemplates included in this configuration.protected static PathTEMPLATESprotected CryptoPropertiesuserConfigProperties representingnuxeo.confwith a fallback ondefaultConfig.
-
Constructor Summary
Constructors Constructor Description ConfigurationHolder(Path home, Path nuxeoConf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclear()PathgetConfigurationPath()PathgetDataPath()StringgetDefaultProperty(String key)Returns the property value associated with the givenkeyfrom the default configuration.PathgetDumpedConfigurationPath()PathgetHomePath()StringgetIncludedDBTemplateName()List<String>getIncludedTemplateNames()List<Path>getIncludedTemplates()PathgetLogConfigPath()PathgetLogPath()PathgetNuxeoConfPath()Optional<String>getOptProperty(String key)Returns the property value associated with the givenkeyfrom the user configuration.protected PathgetPackagesPath()PathgetPidDirPath()StringgetProperty(String key)Returns the property value associated with the givenkeyfrom the user configuration.StringgetProperty(String key, String defaultValue)Returns the property value associated with the givenkeyfrom the user configuration.booleangetPropertyAsBoolean(String key)Returns the property value as a boolean associated with the givenkeyfrom the user configuration.intgetPropertyAsInteger(String key, int defaultValue)Returns the property value as an int associated with the givenkeyfrom the user configuration.PathgetPropertyAsPath(String key)Returns the property value as aPathassociated with the givenkeyfrom the user configuration.StringgetRawProperty(String key)Returns the raw property value associated with the givenkeyfrom the user configuration.PathgetRuntimeHomePath()Returns the Home of NuxeoRuntime (same asFramework.getRuntime().getHome()).PathgetTemplatesPath()PathgetTmpPath()TextTemplateinstantiateTemplateParser()booleanisForceGeneration()booleanisForceGenerationOnce()booleanisLoaded()Set<String>keySet()Returns the user configuration key set.protected StringmakePathAbsolute(String key, String value)protected PropertiesmakePathAbsolute(Properties properties)Stringput(String key, String value)Puts the given property into user configuration.voidputAll(Properties properties)Puts all givenpropertiesinto user configuration.StringputDefault(String key, String value)Puts the given property into default configuration.voidputDefaultAll(Properties properties)Puts all givenpropertiesinto default configuration.voidputTemplateAll(Path template, Properties properties)Puts all givenpropertiesinto default configuration for the given template.Set<String>stringPropertyNames()Returns the user configuration property names.
-
-
-
Field Detail
-
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 oftemplates/nuxeo.defaults,System.getProperties()andnuxeo.defaultsfrom each template.
-
userConfig
protected final CryptoProperties userConfig
Properties representingnuxeo.confwith a fallback ondefaultConfig.
-
-
Method Detail
-
getHomePath
public Path getHomePath()
-
getNuxeoConfPath
public Path getNuxeoConfPath()
-
getTemplatesPath
public Path getTemplatesPath()
-
getRuntimeHomePath
public Path getRuntimeHomePath()
Returns the Home of NuxeoRuntime (same asFramework.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 givenkeyfrom the default configuration.
-
getProperty
public String getProperty(String key)
Returns the property value associated with the givenkeyfrom 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 givenkeyfrom 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 givendefaultValueif the default configuration doesn't contain a property value associated with thenkey.
-
getOptProperty
public Optional<String> getOptProperty(String key)
Returns the property value associated with the givenkeyfrom the user configuration.
-
getPropertyAsBoolean
public boolean getPropertyAsBoolean(String key)
Returns the property value as a boolean associated with the givenkeyfrom the user configuration.
-
getPropertyAsInteger
public int getPropertyAsInteger(String key, int defaultValue)
Returns the property value as an int associated with the givenkeyfrom 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 aPathassociated with the givenkeyfrom 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 givenkeyfrom the user configuration.
-
keySet
public Set<String> keySet()
Returns the user configuration key set.- See Also:
Properties.keySet()
-
stringPropertyNames
public Set<String> stringPropertyNames()
Returns the user configuration property names.- See Also:
Properties.stringPropertyNames()
-
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 givenpropertiesinto default configuration.
-
putAll
public void putAll(Properties properties)
Puts all givenpropertiesinto user configuration.
-
putTemplateAll
public void putTemplateAll(Path template, Properties properties)
Puts all givenpropertiesinto default configuration for the given template.
-
makePathAbsolute
protected Properties makePathAbsolute(Properties properties)
-
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()
-
-