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_LIST
protected Properties
defaultConfig
Properties representing concatenation oftemplates/nuxeo.defaults
,System.getProperties()
andnuxeo.defaults
from each template.protected static Set<String>
DIRECTORY_PARAMETERS
protected Path
home
Path representing the Nuxeo Server home directory.protected static Path
LOG4J2_CONF
protected Path
nuxeoConf
Path representing the Nuxeo Server configuration file.protected static Path
NXSERVER
protected List<Path>
templates
Templates included in this configuration.protected static Path
TEMPLATES
protected CryptoProperties
userConfig
Properties representingnuxeo.conf
with 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 void
clear()
Path
getConfigurationPath()
Path
getDataPath()
String
getDefaultProperty(String key)
Returns the property value associated with the givenkey
from the default configuration.Path
getDumpedConfigurationPath()
Path
getHomePath()
String
getIncludedDBTemplateName()
List<String>
getIncludedTemplateNames()
List<Path>
getIncludedTemplates()
Path
getLogConfigPath()
Path
getLogPath()
Path
getNuxeoConfPath()
Optional<String>
getOptProperty(String key)
Returns the property value associated with the givenkey
from the user configuration.protected Path
getPackagesPath()
Path
getPidDirPath()
String
getProperty(String key)
Returns the property value associated with the givenkey
from the user configuration.String
getProperty(String key, String defaultValue)
Returns the property value associated with the givenkey
from the user configuration.boolean
getPropertyAsBoolean(String key)
Returns the property value as a boolean associated with the givenkey
from the user configuration.int
getPropertyAsInteger(String key, int defaultValue)
Returns the property value as an int associated with the givenkey
from the user configuration.Path
getPropertyAsPath(String key)
Returns the property value as aPath
associated with the givenkey
from the user configuration.String
getRawProperty(String key)
Returns the raw property value associated with the givenkey
from the user configuration.Path
getRuntimeHomePath()
Returns the Home of NuxeoRuntime (same asFramework.getRuntime().getHome()
).Path
getTemplatesPath()
Path
getTmpPath()
TextTemplate
instantiateTemplateParser()
boolean
isForceGeneration()
boolean
isForceGenerationOnce()
boolean
isLoaded()
Set<String>
keySet()
Returns the user configuration key set.protected String
makePathAbsolute(String key, String value)
protected Properties
makePathAbsolute(Properties properties)
String
put(String key, String value)
Puts the given property into user configuration.void
putAll(Properties properties)
Puts all givenproperties
into user configuration.String
putDefault(String key, String value)
Puts the given property into default configuration.void
putDefaultAll(Properties properties)
Puts all givenproperties
into default configuration.void
putTemplateAll(Path template, Properties properties)
Puts all givenproperties
into 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.defaults
from each template.
-
userConfig
protected final CryptoProperties userConfig
Properties representingnuxeo.conf
with 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 givenkey
from the default configuration.
-
getProperty
public String getProperty(String key)
Returns the property value associated with the givenkey
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 givenkey
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 givendefaultValue
if 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 givenkey
from the user configuration.
-
getPropertyAsBoolean
public boolean getPropertyAsBoolean(String key)
Returns the property value as a boolean associated with the givenkey
from the user configuration.
-
getPropertyAsInteger
public int getPropertyAsInteger(String key, int defaultValue)
Returns the property value as an int associated with the givenkey
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 aPath
associated with the givenkey
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 givenkey
from 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 givenproperties
into default configuration.
-
putAll
public void putAll(Properties properties)
Puts all givenproperties
into user configuration.
-
putTemplateAll
public void putTemplateAll(Path template, Properties properties)
Puts all givenproperties
into default configuration for the given template.
-
makePathAbsolute
protected Properties makePathAbsolute(Properties properties)
-
getIncludedTemplates
public List<Path> getIncludedTemplates()
- Returns:
- the absolute
Path
s 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()
-
-