|
Connection Manager 3.6.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.util.JiveGlobals
public class JiveGlobals
Controls Jive properties. Jive properties are only meant to be set and retrieved by core Jive classes. Properties are stored in XML format.
When starting up the application this class needs to be configured so that the initial
configuration of the application may be loaded from the configuration file. The configuration
file holds properties stored in XML format. Use setHomeDirectory(String)
and
setConfigName(String)
for setting the home directory and path to the configuration file.
XML property names must be in the form prop.name
- parts of the name must
be seperated by ".". The value can be any valid String, including strings with line breaks.
This class was copied from Openfire. Properties stored in the DB were removed from the code. Modified #getBooleanProperty to use properties stored in XML.
Field Summary | |
---|---|
static boolean |
failedLoading
|
Constructor Summary | |
---|---|
JiveGlobals()
|
Method Summary | |
---|---|
static void |
deleteXMLProperty(java.lang.String name)
Deletes a locale property. |
static java.lang.String |
formatDateTime(java.util.Date date)
Formats a Date object to return a date and time using the global locale. |
static boolean |
getBooleanProperty(java.lang.String name,
boolean defaultValue)
Returns a boolean value Jive property. |
static java.lang.String |
getHomeDirectory()
Returns the location of the home directory. |
static int |
getIntProperty(java.lang.String name,
int defaultValue)
Returns an integer value Jive property. |
static java.util.Locale |
getLocale()
Returns the global Locale used by Jive. |
static java.util.TimeZone |
getTimeZone()
Returns the global TimeZone used by Jive. |
static java.util.List |
getXMLProperties(java.lang.String parent)
Return all immediate children property values of a parent local property as a list of strings, or an empty list if there are no children. |
static java.lang.String |
getXMLProperty(java.lang.String name)
Returns a local property. |
static int |
getXMLProperty(java.lang.String name,
int defaultValue)
Returns an integer value local property. |
static java.lang.String |
getXMLProperty(java.lang.String name,
java.lang.String defaultValue)
Returns a local property. |
static void |
setConfigName(java.lang.String configName)
Allows the name of the local config file name to be changed. |
static void |
setHomeDirectory(java.lang.String pathname)
Sets the location of the home directory. |
static void |
setLocale(java.util.Locale newLocale)
Sets the global locale used by Jive. |
static void |
setXMLProperties(java.util.Map<java.lang.String,java.lang.String> propertyMap)
Sets multiple local properties at once. |
static void |
setXMLProperty(java.lang.String name,
java.lang.String value)
Sets a local property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean failedLoading
Constructor Detail |
---|
public JiveGlobals()
Method Detail |
---|
public static java.util.Locale getLocale()
public static void setLocale(java.util.Locale newLocale)
newLocale
- the global Locale for Jive.public static java.util.TimeZone getTimeZone()
public static java.lang.String formatDateTime(java.util.Date date)
date
- the Date to format.
public static java.lang.String getHomeDirectory()
home
directory.
public static void setHomeDirectory(java.lang.String pathname)
home
directory. The directory must exist and the
user running the application must have read and write permissions over the specified
directory.
pathname
- the location of the home dir.public static java.lang.String getXMLProperty(java.lang.String name)
<foo> <bar> <prop>some value</prop> </bar> </foo>
name
- the name of the property to return.
public static java.lang.String getXMLProperty(java.lang.String name, java.lang.String defaultValue)
<foo> <bar> <prop>some value</prop> </bar> </foo>If the specified property can't be found, the defaultValue will be returned.
name
- the name of the property to return.defaultValue
- the default value for the property.
public static int getXMLProperty(java.lang.String name, int defaultValue)
<foo> <bar> <prop>some value</prop> </bar> </foo>If the specified property can't be found, or if the value is not a number, the defaultValue will be returned.
name
- the name of the property to return.defaultValue
- value returned if the property could not be loaded or was not
a number.
public static void setXMLProperty(java.lang.String name, java.lang.String value)
<foo> <bar> <prop>some value</prop> </bar> </foo>
name
- the name of the property being set.value
- the value of the property being set.public static void setXMLProperties(java.util.Map<java.lang.String,java.lang.String> propertyMap)
<foo> <bar> <prop>some value</prop> </bar> </foo>
propertyMap
- a map of properties, keyed on property name.public static java.util.List getXMLProperties(java.lang.String parent)
Local properties are stored in the file defined in JIVE_CONFIG_FILENAME that exists in the home directory. Properties are always specified as "foo.bar.prop", which would map to the following entry in the XML file:
<foo> <bar> <prop>some value</prop> </bar> </foo>
parent
- the name of the parent property to return the children for.
public static int getIntProperty(java.lang.String name, int defaultValue)
name
- the name of the property to return.defaultValue
- value returned if the property doesn't exist or was not
a number.
public static boolean getBooleanProperty(java.lang.String name, boolean defaultValue)
name
- the name of the property to return.defaultValue
- value returned if the property doesn't exist.
public static void deleteXMLProperty(java.lang.String name)
name
- the name of the property to delete.public static void setConfigName(java.lang.String configName)
configName
- the name of the config file.
|
Connection Manager 3.6.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |