Package org.jivesoftware.util
Class JiveProperties
java.lang.Object
org.jivesoftware.util.JiveProperties
Retrieves and stores Jive properties. Properties are stored in the database.
- Author:
- Matt Tucker
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) static voidPrevent JiveProperties from interacting with the database.entrySet()booleangetBooleanProperty(String name) booleangetBooleanProperty(String name, boolean defaultValue) getChildrenNames(String parentKey) Return all children property names of a parent property as a Collection of String objects.static JivePropertiesReturns a singleton instance of JiveProperties.getProperty(String name, String defaultValue) Returns all property names as a Collection of String values.voidinit()For internal use only.booleanisEmpty()keySet()Saves a property, optionally encrypting itvoidintsize()values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Method Details
-
disableDatabasePersistence
public static void disableDatabasePersistence()Prevent JiveProperties from interacting with the database. On rare occasions - that typically involve running tests - Openfire code will be invoked without a database being available. In such cases, it's undesirable for properties to be retrieved and stored to the database, as this will require a significant amount of resource usage, but will silently fail. This method can only be invoked beforegetInstance()is being invoked. This intends to prevent a behavioral change at some time after the server was started. -
getInstance
Returns a singleton instance of JiveProperties.- Returns:
- an instance of JiveProperties.
-
init
public void init()For internal use only. This method allows for the reloading of all properties from the values in the database. This is required since it's quite possible during the setup process that a database connection will not be available till after this class is initialized. Thus, if there are existing properties in the database we will want to reload this class after the setup process has been completed. -
size
public int size() -
clear
public void clear() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,String>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,String>
-
values
-
putAll
-
entrySet
-
keySet
-
get
-
getChildrenNames
Return all children property names of a parent property as a Collection of String objects. For example, given the propertiesX.Y.A,X.Y.B, andX.Y.C, then the child properties ofX.YareX.Y.A,X.Y.B, andX.Y.C. The method is not recursive; ie, it does not return children of children.- Parameters:
parentKey- the name of the parent property.- Returns:
- all child property names for the given parent.
-
getPropertyNames
Returns all property names as a Collection of String values.- Returns:
- all property names.
-
remove
-
put
Saves a property, optionally encrypting it- Parameters:
key- The name of the propertyvalue- The value of the propertyisEncrypted-trueto encrypt the property,trueto leave in plain text- Returns:
- The previous value associated with
key, ornullif there was no mapping forkey.
-
put
-
getProperty
-
getBooleanProperty
-
getBooleanProperty
-