Package org.nuxeo.launcher.config
Class ConfigurationMarshaller
- java.lang.Object
-
- org.nuxeo.launcher.config.ConfigurationMarshaller
-
public class ConfigurationMarshaller extends Object
Class used to read/write thenuxeo.conf
file.- Since:
- 11.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ConfigurationMarshaller.NuxeoConfContent
-
Field Summary
Fields Modifier and Type Field Description protected static String
BOUNDARY_BEGIN
protected static String
BOUNDARY_END
protected static String
NEW_FILES
protected static List<String>
NUXEO_SYSTEM_PROPERTIES
protected static String
PROTECTION_COMMENT
protected Properties
systemProperties
-
Constructor Summary
Constructors Constructor Description ConfigurationMarshaller(Properties systemProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
deleteTemplateFiles(ConfigurationHolder configHolder)
Delete files previously deployed by templates.void
dumpConfiguration(ConfigurationHolder configHolder)
protected void
dumpProperties(ConfigurationHolder configHolder)
protected void
editConfiguratorConf(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder)
protected void
editUserConf(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder)
protected boolean
isConfigurationValueEquals(String userValue, String valueToSet)
This method checks the equality of the two given values by taking care that backslash escaping hasn't been performed onuserValue
.protected void
parseAndCopy(ConfigurationHolder configHolder)
Generate configuration files from templates and given configuration parametersvoid
persistNuxeoConf(ConfigurationHolder configHolder)
Map<String,String>
persistNuxeoDefaults(Path nuxeoDefaultsPath, Map<String,String> newParametersToSave)
protected ConfigurationMarshaller.NuxeoConfContent
readConfiguration(Path nuxeoConfPath)
protected void
storeNewFilesList(ConfigurationHolder configHolder, List<String> newFilesList)
Store intoNEW_FILES
the list of new files deployed by the templates.protected void
writeConfiguration(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder)
-
-
-
Field Detail
-
BOUNDARY_BEGIN
protected static final String BOUNDARY_BEGIN
- See Also:
- Constant Field Values
-
BOUNDARY_END
protected static final String BOUNDARY_END
- See Also:
- Constant Field Values
-
PROTECTION_COMMENT
protected static final String PROTECTION_COMMENT
- See Also:
- Constant Field Values
-
NEW_FILES
protected static final String NEW_FILES
- See Also:
- Constant Field Values
-
systemProperties
protected final Properties systemProperties
-
-
Constructor Detail
-
ConfigurationMarshaller
public ConfigurationMarshaller(Properties systemProperties)
-
-
Method Detail
-
persistNuxeoConf
public void persistNuxeoConf(ConfigurationHolder configHolder) throws ConfigurationException
- Throws:
ConfigurationException
-
persistNuxeoDefaults
public Map<String,String> persistNuxeoDefaults(Path nuxeoDefaultsPath, Map<String,String> newParametersToSave) throws ConfigurationException
- Throws:
ConfigurationException
-
readConfiguration
protected ConfigurationMarshaller.NuxeoConfContent readConfiguration(Path nuxeoConfPath) throws ConfigurationException
- Throws:
ConfigurationException
-
editUserConf
protected void editUserConf(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder)
-
editConfiguratorConf
protected void editConfiguratorConf(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder)
-
writeConfiguration
protected void writeConfiguration(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder) throws ConfigurationException
- Throws:
ConfigurationException
-
isConfigurationValueEquals
protected boolean isConfigurationValueEquals(String userValue, String valueToSet)
This method checks the equality of the two given values by taking care that backslash escaping hasn't been performed onuserValue
.- Parameters:
userValue
- the value as it is written innuxeo.conf
valueToSet
- the value coming fromConfigurationHolder
- Returns:
- whether both values are equals regarding the method description.
-
dumpConfiguration
public void dumpConfiguration(ConfigurationHolder configHolder) throws ConfigurationException
- Parameters:
configHolder
- configuration to dump intoconfig
directory- Throws:
ConfigurationException
-
parseAndCopy
protected void parseAndCopy(ConfigurationHolder configHolder) throws IOException, freemarker.template.TemplateException, ConfigurationException
Generate configuration files from templates and given configuration parameters- Throws:
IOException
freemarker.template.TemplateException
ConfigurationException
-
deleteTemplateFiles
protected void deleteTemplateFiles(ConfigurationHolder configHolder) throws IOException, ConfigurationException
Delete files previously deployed by templates. If a file had been overwritten by a template, it will be restored. Helps the server returning to the state before any template was applied.- Throws:
IOException
ConfigurationException
-
storeNewFilesList
protected void storeNewFilesList(ConfigurationHolder configHolder, List<String> newFilesList) throws IOException
Store intoNEW_FILES
the list of new files deployed by the templates. For later use bydeleteTemplateFiles(ConfigurationHolder)
.- Throws:
IOException
-
dumpProperties
protected void dumpProperties(ConfigurationHolder configHolder)
- Parameters:
configHolder
- configuration to dump intoconfig
directory
-
-