Package net.shibboleth.idp.installer
Class PropertiesWithComments
java.lang.Object
net.shibboleth.idp.installer.PropertiesWithComments
A package which is similar to Properties, but allows comments to be preserved. We use the Properties package to parse
the non-comment lines.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA POJO which looks like a property. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe contents.private booleanHave we loaded data?.private final PropertiesName Replacement info.The properties bit.BlackListed property names. -
Constructor Summary
ConstructorsConstructorDescriptionLegacy Constructor.PropertiesWithComments(Set<String> unreplacable) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComment(String what) Append a comment to the list.private voidaddCommentedProperty(String line, boolean isComment) Add a property, either as a key/value pair or as a key/comment pair.voidload(InputStream input) Read the input stream into our structures.voidloadNameReplacement(InputStream input) Read the name replacement data.voidreplaceProperties(Properties replacements) Perform a mass replacement from the suppliedProperties.booleanreplaceProperty(String propName, String newPropValue) Replace the supplied property or stuff it at the bottom of the list.voidstore(OutputStream output) Put the output to the supplied stream.
-
Field Details
-
contents
The contents. EachObjectis either a string (a non-property line) or aPropertiesWithComments.CommentedProperty(an optionally commented property definition). -
properties
The properties bit. -
nameReplacement
Name Replacement info. -
unreplacableNames
BlackListed property names. -
loadedData
private boolean loadedDataHave we loaded data?. We cannot load the replacement names after the file load.
-
-
Constructor Details
-
PropertiesWithComments
public PropertiesWithComments()Legacy Constructor. -
PropertiesWithComments
Constructor.- Parameters:
unreplacable- names to warn on.
-
-
Method Details
-
addCommentedProperty
private void addCommentedProperty(@Nonnull @NotEmpty String line, boolean isComment) throws IOException Add a property, either as a key/value pair or as a key/comment pair.- Parameters:
line- what to look atisComment- whether this is a comment or not.- Throws:
IOException- when badness happens.
-
loadNameReplacement
Read the name replacement data.- Parameters:
input- what to read- Throws:
IOException- if readline fails
-
load
Read the input stream into our structures.- Parameters:
input- what to read- Throws:
IOException- if readline fails
-
store
Put the output to the supplied stream.- Parameters:
output- where to write- Throws:
IOException- is the write fails
-
replaceProperties
Perform a mass replacement from the suppliedProperties.- Parameters:
replacements- what to replace.
-
replaceProperty
Replace the supplied property or stuff it at the bottom of the list.- Parameters:
propName- the name of the property to replacenewPropValue- the value to replace- Returns:
- true if the property was replaced false if it was added
-
addComment
Append a comment to the list.- Parameters:
what- what to add
-