Class JiveProperties

java.lang.Object
org.jivesoftware.util.JiveProperties
All Implemented Interfaces:
Map<String,String>

public class JiveProperties extends Object implements Map<String,String>
Retrieves and stores Jive properties. Properties are stored in the database.
Author:
Matt Tucker
  • 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 before getInstance() is being invoked. This intends to prevent a behavioral change at some time after the server was started.
    • getInstance

      public static JiveProperties 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()
      Specified by:
      size in interface Map<String,String>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<String,String>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<String,String>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<String,String>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<String,String>
    • values

      public Collection<String> values()
      Specified by:
      values in interface Map<String,String>
    • putAll

      public void putAll(Map<? extends String,? extends String> t)
      Specified by:
      putAll in interface Map<String,String>
    • entrySet

      public Set<Map.Entry<String,String>> entrySet()
      Specified by:
      entrySet in interface Map<String,String>
    • keySet

      public Set<String> keySet()
      Specified by:
      keySet in interface Map<String,String>
    • get

      public String get(Object key)
      Specified by:
      get in interface Map<String,String>
    • getChildrenNames

      public Collection<String> getChildrenNames(String parentKey)
      Return all children property names of a parent property as a Collection of String objects. For example, given the properties X.Y.A, X.Y.B, and X.Y.C, then the child properties of X.Y are X.Y.A, X.Y.B, and X.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

      public Collection<String> getPropertyNames()
      Returns all property names as a Collection of String values.
      Returns:
      all property names.
    • remove

      public String remove(Object key)
      Specified by:
      remove in interface Map<String,String>
    • put

      public String put(String key, String value, boolean isEncrypted)
      Saves a property, optionally encrypting it
      Parameters:
      key - The name of the property
      value - The value of the property
      isEncrypted - true to encrypt the property, true to leave in plain text
      Returns:
      The previous value associated with key, or null if there was no mapping for key.
    • put

      public String put(String key, String value)
      Specified by:
      put in interface Map<String,String>
    • getProperty

      public String getProperty(String name, String defaultValue)
    • getBooleanProperty

      public boolean getBooleanProperty(String name)
    • getBooleanProperty

      public boolean getBooleanProperty(String name, boolean defaultValue)