Package org.jivesoftware.util
Class SystemProperty<T>
java.lang.Object
org.jivesoftware.util.SystemProperty<T>
- Type Parameters:
T
- The type of system property.
Represents a system property - also accessible via
JiveGlobals
. The only way to create a SystemProperty object
is to use a SystemProperty.Builder
.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(Consumer<T> listener) getKey()
static Collection<SystemProperty>
static Optional<SystemProperty>
getProperty
(String key) Returns the SystemProperty for the specified keygetValue()
boolean
boolean
boolean
boolean
void
removeListener
(Consumer<T> listener) static void
removePropertiesForPlugin
(String plugin) Removes all the properties for a specific plugin.void
Sets the value of the SystemProperty.
-
Method Details
-
getProperties
- Returns:
- an unmodifiable collection of all the current SystemProperties
-
removePropertiesForPlugin
Removes all the properties for a specific plugin. This should be called by a plugin when it is unloaded to allow it to be added again without a server restart- Parameters:
plugin
- The plugin for which properties should be removed
-
getProperty
Returns the SystemProperty for the specified key- Parameters:
key
- the key for the property to fetch- Returns:
- The SystemProperty for that key, if any
-
getValue
- Returns:
- the current value of the SystemProperty, or the default value if it is not currently set to within the
configured constraints.
null
if the property has not been set and there is no default value.
-
getValueAsSaved
- Returns:
- the value of this property as saved in the ofProperty table.
null
if there is no current value and the default is not set.
-
getDisplayValue
- Returns:
- the value a human readable value of this property.
null
if there is no current value and the default is not set.
-
hasValueChanged
public boolean hasValueChanged()- Returns:
false
if the property has been changed from it's default value, otherwisetrue
-
getDefaultDisplayValue
- Returns:
- the value a human readable value of this property.
null
if the default value is not configured.
-
setValue
Sets the value of the SystemProperty. Note that the new value can be outside any minimum/maximum for the property, and will be saved to the database as such, however subsequent attempts to retrieve it's value will return the default.- Parameters:
value
- the new value for the SystemProperty
-
getPlugin
- Returns:
- the plugin that created this property - or simply
"Openfire"
-
isDynamic
public boolean isDynamic()- Returns:
false
if Openfire or the plugin needs to be restarted for changes to this property to take effect, otherwisetrue
-
isEncrypted
public boolean isEncrypted()- Returns:
true
if the property was initially setup to be encrypted, or was encrypted subsequently, otherwisefalse
-
isRestartRequired
public boolean isRestartRequired()- Returns:
true
if this property has changed and an Openfire or plugin restart is required, otherwisefalse
-
addListener
- Parameters:
listener
- a listener to add to the property, that will be called whenever the property value changes
-
removeListener
- Parameters:
listener
- the listener that is no longer required
-
getKey
- Returns:
- the
JiveGlobals
key for this property.
-
getDescription
- Returns:
- the description of this property. This is set in the resource bundle for the current locale, using the
key
system_property.
property-key.
-
getDefaultValue
- Returns:
- the default value of this property.
null
if there is no default value configured.
-