-
public interface ConfigurationServiceThe configuration services provides a centralized approach of storing persistent configuration data.
-
-
Method Summary
Modifier and Type Method Description abstract voidsetProperty(String propertyName, Object property)Sets the property with the specified name to the specified value. abstract voidsetProperty(String propertyName, Object property, boolean isSystem)Sets the property with the specified name to the specified value. abstract voidsetProperties(Map<String, Object> properties)Sets a set of specific properties to specific values as a batch operationmeaning that first VetoableChangeListeners are asked toapprove the modifications of the specified properties to the specifiedvalues, then the modifications are performed if no complaints have beenraised in the form ofPropertyVetoExceptionand finallyPropertyChangeListeners are notified about the changes ofeach of the specified properties.abstract ObjectgetProperty(String propertyName)Returns the value of the property with the specified name or null if nosuch property exists. abstract voidremoveProperty(String propertyName)Removes the property with the specified name. abstract List<String>getAllPropertyNames()Returns a List of Strings containing allproperty names. abstract List<String>getPropertyNamesByPrefix(String prefix, boolean exactPrefixMatch)Returns a List of Strings containing all property namesthat have the specified prefix. abstract List<String>getPropertyNamesBySuffix(String suffix)Returns a List of Strings containing the property namesthat have the specified suffix. abstract StringgetString(String propertyName)Returns the String value of the specified property and null in case noproperty value was mapped against the specified propertyName, or incase the returned property string had zero length or containedwhitespaces only. abstract StringgetString(String propertyName, String defaultValue)Returns the String value of the specified property and null in case noproperty value was mapped against the specified propertyName, or incase the returned property string had zero length or containedwhitespaces only. abstract booleangetBoolean(String propertyName, boolean defaultValue)Gets the value of a specific property as a boolean. abstract intgetInt(String propertyName, int defaultValue)Gets the value of a specific property as a signed decimal integer. abstract doublegetDouble(String propertyName, double defaultValue)Gets the value of a specific property as a double. abstract longgetLong(String propertyName, long defaultValue)Gets the value of a specific property as a signed decimal long integer. abstract voidaddPropertyChangeListener(PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list. abstract voidremovePropertyChangeListener(PropertyChangeListener listener)Removes a PropertyChangeListener from the listener list. abstract voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener)Adds a PropertyChangeListener to the listener list for a specificproperty. abstract voidremovePropertyChangeListener(String propertyName, PropertyChangeListener listener)Removes a PropertyChangeListener from the listener list for a specificproperty. abstract voidaddVetoableChangeListener(ConfigVetoableChangeListener listener)Adds a VetoableChangeListener to the listener list. abstract voidremoveVetoableChangeListener(ConfigVetoableChangeListener listener)Removes a VetoableChangeListener from the listener list. abstract voidaddVetoableChangeListener(String propertyName, ConfigVetoableChangeListener listener)Adds a VetoableChangeListener to the listener list for a specificproperty. abstract voidremoveVetoableChangeListener(String propertyName, ConfigVetoableChangeListener listener)Removes a VetoableChangeListener from the listener list for a specificproperty. abstract voidstoreConfiguration()Store the current set of properties back to the configuration file. abstract voidreloadConfiguration()Deletes the current configuration and reloads it from the configurationfile. abstract voidpurgeStoredConfiguration()Removes all locally stored properties leaving an empty configuration.Implementations that use a file for storing properties may simply deleteit when this method is called. abstract voidlogConfigurationProperties(String passwordPattern)Prints all configuration properties on 'INFO' logging level *except*that properties which name matches given regular expression will havetheir values masked with ***. abstract StringgetScHomeDirName()Returns the name of the directory where Jitsi is to store userspecific data such as configuration files, message and call historyas well as is bundle repository. abstract StringgetScHomeDirLocation()Returns the location of the directory where Jitsi is to storeuser specific data such as configuration files, message and call historyas well as is bundle repository. abstract StringgetConfigurationFilename()Use with caution!Returns the name of the configuration file currentlyused. -
-
Method Detail
-
setProperty
abstract void setProperty(String propertyName, Object property)
Sets the property with the specified name to the specified value. Callingthis method would first trigger a PropertyChangeEvent that willbe dispatched to all VetoableChangeListeners. In case no complaints(PropertyVetoException) have been received, the property will be actuallychanged and a PropertyChangeEvent will be dispatched.
- Parameters:
propertyName- the name of the property to change.property- the new value of the specified property.
-
setProperty
abstract void setProperty(String propertyName, Object property, boolean isSystem)
Sets the property with the specified name to the specified value. Callingthis method would first trigger a PropertyChangeEvent that willbe dispatched to all VetoableChangeListeners. In case no complaints(PropertyVetoException) have been received, the property will be actuallychanged and a PropertyChangeEvent will be dispatched. This method alsoallows the caller to specify whether or not the specified property is asystem one.
- Parameters:
propertyName- the name of the property to change.property- the new value of the specified property.isSystem- specifies whether or not the property being set is aSystem property and should be resolved against the system property set.
-
setProperties
abstract void setProperties(Map<String, Object> properties)
Sets a set of specific properties to specific values as a batch operationmeaning that first
VetoableChangeListeners are asked toapprove the modifications of the specified properties to the specifiedvalues, then the modifications are performed if no complaints have beenraised in the form ofPropertyVetoExceptionand finallyPropertyChangeListeners are notified about the changes ofeach of the specified properties. The batch operations allows theConfigurationServiceimplementations to optimize, forexample, the saving of the configuration which in this case can beperformed only once for the setting of multiple properties.- Parameters:
properties- a Map of property names to their new values tobe set.
-
getProperty
abstract Object getProperty(String propertyName)
Returns the value of the property with the specified name or null if nosuch property exists.
- Parameters:
propertyName- the name of the property that is being queried.
-
removeProperty
abstract void removeProperty(String propertyName)
Removes the property with the specified name. Callingthis method would first trigger a PropertyChangeEvent that willbe dispatched to all VetoableChangeListeners. In case no complaints(PropertyVetoException) have been received, the property will be actuallychanged and a PropertyChangeEvent will be dispatched.All properties with prefix propertyName will also be removed.
- Parameters:
propertyName- the name of the property to change.
-
getAllPropertyNames
abstract List<String> getAllPropertyNames()
Returns a List of Strings containing allproperty names.
-
getPropertyNamesByPrefix
abstract List<String> getPropertyNamesByPrefix(String prefix, boolean exactPrefixMatch)
Returns a List of Strings containing all property namesthat have the specified prefix. The return value will include propertynames that have prefixes longer than specified, unless theexactPrefixMatch parameter is true.
Example:
Imagine a configuration service instance containing 2 properties only:
net.java.sip.communicator.PROP1=value1net.java.sip.communicator.service.protocol.PROP1=value2A call to this method with a prefix="net.java.sip.communicator" andexactPrefixMatch=true would only return the first property -net.java.sip.communicator.PROP1, whereas the same call withexactPrefixMatch=false would return both properties as the second prefixincludes the requested prefix string.
- Parameters:
prefix- a String containing the prefix (the non dotted non-capspart of a property name) that we're looking for.exactPrefixMatch- a boolean indicating whether the returnedproperty names should all have a prefix that is an exact match of thethe prefix param or whether properties with prefixes thatcontain it but are longer than it are also accepted.
-
getPropertyNamesBySuffix
abstract List<String> getPropertyNamesBySuffix(String suffix)
Returns a List of Strings containing the property namesthat have the specified suffix. A suffix is considered to be everythingafter the last dot in the property name.
For example, imagine a configuration service instance containing twoproperties only:
net.java.sip.communicator.PROP1=value1net.java.sip.communicator.service.protocol.PROP1=value2A call to this method with suffix equal to "PROP1" will returnboth properties, whereas the call with suffix equal to"communicator.PROP1" or "PROP2" will return an empty List. Thus,if the suffix argument contains a dot, nothing will be found.
- Parameters:
suffix- the suffix for the property names to be returned
-
getString
abstract String getString(String propertyName)
Returns the String value of the specified property and null in case noproperty value was mapped against the specified propertyName, or incase the returned property string had zero length or containedwhitespaces only.
- Parameters:
propertyName- the name of the property that is being queried.
-
getString
abstract String getString(String propertyName, String defaultValue)
Returns the String value of the specified property and null in case noproperty value was mapped against the specified propertyName, or incase the returned property string had zero length or containedwhitespaces only.
- Parameters:
propertyName- the name of the property that is being queried.defaultValue- the value to be returned if the specified propertyname is not associated with a value in thisConfigurationService
-
getBoolean
abstract boolean getBoolean(String propertyName, boolean defaultValue)
Gets the value of a specific property as a boolean. If the specifiedproperty name is associated with a value in this
ConfigurationService, the string representation of the valueis parsed into a boolean according to the rules of parseBoolean . Otherwise,defaultValueis returned.- Parameters:
propertyName- the name of the property to get the value of as a booleandefaultValue- the value to be returned if the specified property name is notassociated with a value in thisConfigurationService
-
getInt
abstract int getInt(String propertyName, int defaultValue)
Gets the value of a specific property as a signed decimal integer. If thespecified property name is associated with a value in thisConfigurationService, the string representation of the value isparsed into a signed decimal integer according to the rules of parseInt . If parsing the value as a signeddecimal integer fails or there is no value associated with the specifiedproperty name, defaultValue is returned.
- Parameters:
propertyName- the name of the property to get the value of as asigned decimal integerdefaultValue- the value to be returned if parsing the value of thespecified property name as a signed decimal integer fails or there is novalue associated with the specified property name in thisConfigurationService
-
getDouble
abstract double getDouble(String propertyName, double defaultValue)
Gets the value of a specific property as a double. If the specifiedproperty name is associated with a value in thisConfigurationService, the string representation of the value isparsed into a double according to the rules of . If there is no value, or parsing of thevalue fails, defaultValue is returned.
- Parameters:
propertyName- the name of the property.defaultValue- the default value to be returned.
-
getLong
abstract long getLong(String propertyName, long defaultValue)
Gets the value of a specific property as a signed decimal long integer.If the specified property name is associated with a value in thisConfigurationService, the string representation of the value isparsed into a signed decimal long integer according to the rules of parseLong . If parsing the value as a signeddecimal long integer fails or there is no value associated with thespecified property name, defaultValue is returned.
- Parameters:
propertyName- the name of the property to get the value of as asigned decimal long integerdefaultValue- the value to be returned if parsing the value of thespecified property name as a signed decimal long integer fails or thereis no value associated with the specified property name in thisConfigurationService
-
addPropertyChangeListener
abstract void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listeneris registered for all properties in the current configuration.
- Parameters:
listener- the PropertyChangeListener to be added
-
removePropertyChangeListener
abstract void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list.
- Parameters:
listener- the PropertyChangeListener to be removed
-
addPropertyChangeListener
abstract void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specificproperty. In case a property with the specified name does not exist thelistener is still added and would only be taken into account from themoment such a property is set by someone.
- Parameters:
propertyName- one of the property names listed abovelistener- the PropertyChangeListener to be added
-
removePropertyChangeListener
abstract void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specificproperty. This method should be used to remove PropertyChangeListenersthat were registered for a specific property. The method has no effectwhen called for a listener that was not registered for that specificproperty.
- Parameters:
propertyName- a valid property namelistener- the PropertyChangeListener to be removed
-
addVetoableChangeListener
abstract void addVetoableChangeListener(ConfigVetoableChangeListener listener)
Adds a VetoableChangeListener to the listener list. The listener isregistered for all properties in the configuration.
- Parameters:
listener- the VetoableChangeListener to be added
-
removeVetoableChangeListener
abstract void removeVetoableChangeListener(ConfigVetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list.
- Parameters:
listener- the VetoableChangeListener to be removed
-
addVetoableChangeListener
abstract void addVetoableChangeListener(String propertyName, ConfigVetoableChangeListener listener)
Adds a VetoableChangeListener to the listener list for a specificproperty.
- Parameters:
propertyName- one of the property names listed abovelistener- the VetoableChangeListener to be added
-
removeVetoableChangeListener
abstract void removeVetoableChangeListener(String propertyName, ConfigVetoableChangeListener listener)
Removes a VetoableChangeListener from the listener list for a specificproperty.
- Parameters:
propertyName- a valid property namelistener- the VetoableChangeListener to be removed
-
storeConfiguration
abstract void storeConfiguration()
Store the current set of properties back to the configuration file. Thename of the configuration file is queried from the system propertynet.java.sip.communicator.PROPERTIES_FILE_NAME, and is set tosip-communicator.xml in case the property does not contain a valid filename. The location might be one of three possible, checked in thefollowing order: 1. The current directory. 2. The sip-communicator directory in the user.home($HOME/.sip-communicator)3. A location in the classpath (such as the sip-communicator jar file).
In the last case the file is copied to the sip-communicator configurationdirectory right after being extracted from the classpath location.
-
reloadConfiguration
abstract void reloadConfiguration()
Deletes the current configuration and reloads it from the configurationfile. The name of the configuration file is queried from the systemproperty net.java.sip.communicator.PROPERTIES_FILE_NAME, and is set tosip-communicator.xml in case the property does not contain a valid filename. The location might be one of three possible, checked in thefollowing order: 1. The current directory. 2. The sip-communicator directory in the user.home($HOME/.sip-communicator)3. A location in the classpath (such as the sip-communicator jar file).
In the last case the file is copied to the sip-communicator configurationdirectory right after being extracted from the classpath location.
-
purgeStoredConfiguration
abstract void purgeStoredConfiguration()
Removes all locally stored properties leaving an empty configuration.Implementations that use a file for storing properties may simply deleteit when this method is called.
-
logConfigurationProperties
abstract void logConfigurationProperties(String passwordPattern)
Prints all configuration properties on 'INFO' logging level *except*that properties which name matches given regular expression will havetheir values masked with ***.
- Parameters:
passwordPattern- regular expression which detects properties whichvalues should be masked.
-
getScHomeDirName
abstract String getScHomeDirName()
Returns the name of the directory where Jitsi is to store userspecific data such as configuration files, message and call historyas well as is bundle repository.
-
getScHomeDirLocation
abstract String getScHomeDirLocation()
Returns the location of the directory where Jitsi is to storeuser specific data such as configuration files, message and call historyas well as is bundle repository.
-
getConfigurationFilename
abstract String getConfigurationFilename()
Use with caution!Returns the name of the configuration file currentlyused. Placed in HomeDirLocation/HomeDirName getScHomeDirLocationgetScHomeDirName
-
-
-
-