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.conffile.- Since:
- 11.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classConfigurationMarshaller.NuxeoConfContent
-
Field Summary
Fields Modifier and Type Field Description protected static StringBOUNDARY_BEGINprotected static StringBOUNDARY_ENDprotected static StringNEW_FILESprotected static List<String>NUXEO_SYSTEM_PROPERTIESprotected static StringPROTECTION_COMMENTprotected PropertiessystemProperties
-
Constructor Summary
Constructors Constructor Description ConfigurationMarshaller(Properties systemProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddeleteTemplateFiles(ConfigurationHolder configHolder)Delete files previously deployed by templates.voiddumpConfiguration(ConfigurationHolder configHolder)protected voiddumpProperties(ConfigurationHolder configHolder)protected voideditConfiguratorConf(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder)protected voideditUserConf(ConfigurationMarshaller.NuxeoConfContent content, ConfigurationHolder configHolder)protected booleanisConfigurationValueEquals(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 voidparseAndCopy(ConfigurationHolder configHolder)Generate configuration files from templates and given configuration parametersvoidpersistNuxeoConf(ConfigurationHolder configHolder)Map<String,String>persistNuxeoDefaults(Path nuxeoDefaultsPath, Map<String,String> newParametersToSave)protected ConfigurationMarshaller.NuxeoConfContentreadConfiguration(Path nuxeoConfPath)protected voidstoreNewFilesList(ConfigurationHolder configHolder, List<String> newFilesList)Store intoNEW_FILESthe list of new files deployed by the templates.protected voidwriteConfiguration(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.confvalueToSet- 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 intoconfigdirectory- Throws:
ConfigurationException
-
parseAndCopy
protected void parseAndCopy(ConfigurationHolder configHolder) throws IOException, freemarker.template.TemplateException, ConfigurationException
Generate configuration files from templates and given configuration parameters- Throws:
IOExceptionfreemarker.template.TemplateExceptionConfigurationException
-
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:
IOExceptionConfigurationException
-
storeNewFilesList
protected void storeNewFilesList(ConfigurationHolder configHolder, List<String> newFilesList) throws IOException
Store intoNEW_FILESthe 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 intoconfigdirectory
-
-