public class JahiaPropertiesUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JahiaPropertiesUtils.RemoveOperation
Remove operation to remove content from jahia.properties file
Operation type are used to specify the nature of the operation:
EXACT_BLOCK: accept multiple lines deletion and search for that exact lines in the file then remove them
REGEXP_LINE: accept only one line deletion and search for the first line that match the regexp, then remove it
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addEntry(String key,
String value,
String comment,
String afterLinePattern,
File jahiaPropertiesFile)
Add the provided entry into the specified properties file.
|
static void |
addEntry(String key,
String value,
String comment,
String afterLinePattern,
String error)
Add the provided entry into the automatically detected jahia.properties file.
|
static File |
detectJahiaPropertiesFile()
Detects the location of a jahia.properties file.
|
static String |
getCommentedPropertyLine(String key,
List<String> lines) |
static String |
getPropertyLine(String key,
List<String> lines) |
static void |
jahiaPropertiesFileNotFound() |
static void |
removeEntry(JahiaPropertiesUtils.RemoveOperation[] operations)
Remove content from jahia.properties, look at the RemoveOperation class java doc to see all the possibility available
|
static void |
replace(String searchString,
String replacement)
Replaces all occurrences of the specified string in the jahia.properties file with the provided replacement.
|
static void |
uncommentOrAddEntryIfMissing(String key,
String defaultValue)
Set a property to its default value in case the property is missing from the java.properties file.
|
public static final Charset CHARSET
public static final void addEntry(String key, String value, String comment, String afterLinePattern, File jahiaPropertiesFile) throws IOException
key - the key to be addedvalue - the key value to be addedcomment - the entry commentafterLinePattern - the pattern of the line after which the entry should be added; null if the entry should be
appended to the end of the filejahiaPropertiesFile - the target properties fileIOException - in case of an I/O errorpublic static void removeEntry(JahiaPropertiesUtils.RemoveOperation[] operations) throws IOException
operations - the remove operationsIOException - in case of an I/O errorpublic static void replace(String searchString, String replacement) throws IOException
searchString - the string to be replacedreplacement - the replacementIOException - in case of an I/O errorpublic static final void addEntry(String key, String value, String comment, String afterLinePattern, String error) throws IOException
key - the key to be addedvalue - the key value to be addedcomment - the entry commentafterLinePattern - the pattern of the line after which the entry should be added; null if the entry should be
appended to the end of the fileIOException - in case of an I/O errorpublic static final void uncommentOrAddEntryIfMissing(String key, String defaultValue) throws IOException
Note, multiline property values are unsupported.
key - Property keydefaultValue - Default property valueIOExceptionpublic static String getCommentedPropertyLine(String key, List<String> lines)
public static void jahiaPropertiesFileNotFound()
public static File detectJahiaPropertiesFile() throws IOException
null if the file could not be foundIOException - in case of an I/O errorCopyright © 2004–2021 Jahia Solutions Group SA. All rights reserved.