Commit dcffb573 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Jive properties are now broken into two types -- XML properties from a local...

Jive properties are now broken into two types -- XML properties from a local config file and normal properties that are stored in the database.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@73 b35dd754-fafc-0310-a699-88a17e54d16e
parent dc2a48fd
......@@ -69,7 +69,7 @@ public class DbConnectionManager {
if (connectionProvider == null) {
// Attempt to load the connection provider classname as
// a Jive property.
String className = JiveGlobals.getJiveProperty("connectionProvider.className");
String className = JiveGlobals.getXMLProperty("connectionProvider.className");
if (className != null) {
// Attempt to load the class.
try {
......@@ -268,7 +268,7 @@ public class DbConnectionManager {
}
}
// Remember what connection provider we want to use for restarts.
JiveGlobals.setJiveProperty("connectionProvider.className",
JiveGlobals.setProperty("connectionProvider.className",
provider.getClass().getName());
}
......
......@@ -13,8 +13,6 @@ package org.jivesoftware.database;
import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.database.ConnectionPool;
import org.jivesoftware.database.ConnectionProvider;
import java.io.IOException;
import java.sql.Connection;
......@@ -276,15 +274,15 @@ public class DefaultConnectionProvider implements ConnectionProvider {
* Load properties that already exist from Jive properties.
*/
private void loadProperties() {
driver = JiveGlobals.getJiveProperty("database.defaultProvider.driver");
serverURL = JiveGlobals.getJiveProperty("database.defaultProvider.serverURL");
username = JiveGlobals.getJiveProperty("database.defaultProvider.username");
password = JiveGlobals.getJiveProperty("database.defaultProvider.password");
String minCons = JiveGlobals.getJiveProperty("database.defaultProvider.minConnections");
String maxCons = JiveGlobals.getJiveProperty("database.defaultProvider.maxConnections");
String conTimeout = JiveGlobals.getJiveProperty("database.defaultProvider.connectionTimeout");
driver = JiveGlobals.getXMLProperty("database.defaultProvider.driver");
serverURL = JiveGlobals.getXMLProperty("database.defaultProvider.serverURL");
username = JiveGlobals.getXMLProperty("database.defaultProvider.username");
password = JiveGlobals.getXMLProperty("database.defaultProvider.password");
String minCons = JiveGlobals.getXMLProperty("database.defaultProvider.minConnections");
String maxCons = JiveGlobals.getXMLProperty("database.defaultProvider.maxConnections");
String conTimeout = JiveGlobals.getXMLProperty("database.defaultProvider.connectionTimeout");
// See if we should use Unicode under MySQL
mysqlUseUnicode = Boolean.valueOf(JiveGlobals.getJiveProperty("database.mysql.useUnicode")).booleanValue();
mysqlUseUnicode = Boolean.valueOf(JiveGlobals.getXMLProperty("database.mysql.useUnicode")).booleanValue();
try {
if (minCons != null) {
minConnections = Integer.parseInt(minCons);
......@@ -307,16 +305,16 @@ public class DefaultConnectionProvider implements ConnectionProvider {
*/
private void saveProperties() {
JiveGlobals.setJiveProperty("database.defaultProvider.driver", driver);
JiveGlobals.setJiveProperty("database.defaultProvider.serverURL", serverURL);
JiveGlobals.setJiveProperty("database.defaultProvider.username", username);
JiveGlobals.setJiveProperty("database.defaultProvider.password", password);
JiveGlobals.setXMLProperty("database.defaultProvider.driver", driver);
JiveGlobals.setXMLProperty("database.defaultProvider.serverURL", serverURL);
JiveGlobals.setXMLProperty("database.defaultProvider.username", username);
JiveGlobals.setXMLProperty("database.defaultProvider.password", password);
JiveGlobals.setJiveProperty("database.defaultProvider.minConnections",
JiveGlobals.setXMLProperty("database.defaultProvider.minConnections",
Integer.toString(minConnections));
JiveGlobals.setJiveProperty("database.defaultProvider.maxConnections",
JiveGlobals.setXMLProperty("database.defaultProvider.maxConnections",
Integer.toString(maxConnections));
JiveGlobals.setJiveProperty("database.defaultProvider.connectionTimeout",
JiveGlobals.setXMLProperty("database.defaultProvider.connectionTimeout",
Double.toString(connectionTimeout));
}
}
......@@ -64,7 +64,7 @@ public class JNDIDataSourceProvider implements ConnectionProvider {
* Initialize.
*/
public JNDIDataSourceProvider() {
dataSourceName = JiveGlobals.getJiveProperty("database.JNDIProvider.name");
dataSourceName = JiveGlobals.getXMLProperty("database.JNDIProvider.name");
}
public String getName() {
......@@ -103,7 +103,7 @@ public class JNDIDataSourceProvider implements ConnectionProvider {
Properties contextProperties = new Properties();
for (int i = 0; i < jndiPropertyKeys.length; i++) {
String k = jndiPropertyKeys[i];
String v = JiveGlobals.getJiveProperty(k);
String v = JiveGlobals.getXMLProperty(k);
if (v != null) {
contextProperties.setProperty(k, v);
}
......@@ -157,7 +157,7 @@ public class JNDIDataSourceProvider implements ConnectionProvider {
public void setProperty(String name, String value) {
if ("name".equals(name)) {
this.dataSourceName = value;
JiveGlobals.setJiveProperty("database.JNDIProvider.name", value);
JiveGlobals.setXMLProperty("database.JNDIProvider.name", value);
}
}
......@@ -185,4 +185,4 @@ public class JNDIDataSourceProvider implements ConnectionProvider {
private final void error(String msg, Exception e) {
Log.error(msg, e);
}
}
}
\ No newline at end of file
......@@ -11,19 +11,19 @@
package org.jivesoftware.messenger;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.XMLProperties;
import org.jivesoftware.util.XPPReader;
import org.jivesoftware.util.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import java.util.*;
import org.dom4j.Document;
import javax.naming.InitialContext;
/**
* This class controls Jive properties. Jive properties are only meant to be set and retrieved
* by core Jive classes.<p>
......@@ -53,7 +53,9 @@ import org.dom4j.Document;
*/
public class JiveGlobals {
private static final String JIVE_CONFIG_FILENAME = "jive-messenger.xml";
private static String JIVE_CONFIG_FILENAME = "jive-messenger.xml";
private static final String DEFAULT_CHAR_ENCODING = "UTF-8";
/**
* Location of the jiveHome directory. All configuration files should be
......@@ -63,10 +65,8 @@ public class JiveGlobals {
public static boolean failedLoading = false;
/**
* XML properties to actually get and set the Jive properties.
*/
private static XMLProperties properties = null;
private static XMLProperties xmlProperties = null;
private static JiveProperties properties = null;
private static Locale locale = null;
private static TimeZone timeZone = null;
......@@ -83,16 +83,28 @@ public class JiveGlobals {
*/
public static Locale getLocale() {
if (locale == null) {
loadProperties();
}
if (locale != null) {
return locale;
}
else {
// we don't want the locale to be null ever so just return the system default locale
return Locale.getDefault();
if (properties != null) {
String language = (String)properties.get("locale.language");
if (language == null) {
language = "";
}
String country = (String)properties.get("locale.country");
if (country == null) {
country = "";
}
// If no locale info is specified, return the system default Locale.
if (language.equals("") && country.equals("")) {
locale = Locale.getDefault();
}
else {
locale = new Locale(language, country);
}
}
else {
return Locale.getDefault();
}
}
return locale;
}
/**
......@@ -105,8 +117,8 @@ public class JiveGlobals {
public static void setLocale(Locale newLocale) {
locale = newLocale;
// Save values to Jive properties.
setJiveProperty("locale.country", locale.getCountry());
setJiveProperty("locale.language", locale.getLanguage());
setProperty("locale.country", locale.getCountry());
setProperty("locale.language", locale.getLanguage());
// Reset the date formatter objects
dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
......@@ -127,7 +139,7 @@ public class JiveGlobals {
* by your JVM. A list of encodings supported by the Sun JVM can be found
* <a href="http://java.sun.com/j2se/1.3/docs/guide/intl/encoding.doc.html">
* here.</a><p>
* <p/>
*
* In order for a particular encoding to work (such as Unicode), your
* application server and database may need to be specially configured.
* Please consult your server documentation for more information. For
......@@ -143,8 +155,21 @@ public class JiveGlobals {
* @return the global Jive character encoding.
*/
public static String getCharacterEncoding() {
if (locale == null) {
loadProperties();
if (characterEncoding == null) {
if (properties != null) {
String charEncoding = (String)properties.get("locale.characterEncoding");
if (charEncoding != null) {
characterEncoding = charEncoding;
}
else {
// The default encoding is ISO-8859-1. We use the version of
// the encoding name that seems to be most widely compatible.
characterEncoding = DEFAULT_CHAR_ENCODING;
}
}
else {
return DEFAULT_CHAR_ENCODING;
}
}
return characterEncoding;
}
......@@ -161,7 +186,7 @@ public class JiveGlobals {
* by your JVM. A list of encodings supported by the Sun JVM can be found
* <a href="http://java.sun.com/j2se/1.3/docs/guide/intl/encoding.doc.html">
* here.</a><p>
* <p/>
*
* In order for a particular encoding to work (such as Unicode), your
* application server and database may need to be specially configured.
* Please consult your server documentation for more information. For
......@@ -178,7 +203,7 @@ public class JiveGlobals {
*/
public static void setCharacterEncoding(String characterEncoding) {
JiveGlobals.characterEncoding = characterEncoding;
setJiveProperty("locale.characterEncoding", characterEncoding);
setProperty("locale.characterEncoding", characterEncoding);
}
/**
......@@ -188,8 +213,19 @@ public class JiveGlobals {
* @return the global time zone used by Jive.
*/
public static TimeZone getTimeZone() {
if (locale == null) {
loadProperties();
if (timeZone == null) {
if (properties != null) {
String timeZoneID = (String)properties.get("locale.timeZone");
if (timeZoneID == null) {
timeZone = TimeZone.getDefault();
}
else {
timeZone = TimeZone.getTimeZone(timeZoneID);
}
}
else {
return TimeZone.getDefault();
}
}
return timeZone;
}
......@@ -202,7 +238,7 @@ public class JiveGlobals {
timeZone = newTimeZone;
dateFormat.setTimeZone(timeZone);
dateTimeFormat.setTimeZone(timeZone);
setJiveProperty("locale.timeZone", timeZone.getID());
setProperty("locale.timeZone", timeZone.getID());
}
/**
......@@ -212,8 +248,16 @@ public class JiveGlobals {
* @return a String representing the date.
*/
public static String formatDate(Date date) {
if (locale == null) {
loadProperties();
if (dateFormat == null) {
if (properties != null) {
dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, getLocale());
dateFormat.setTimeZone(getTimeZone());
}
else {
DateFormat instance = DateFormat.getDateInstance(DateFormat.MEDIUM, getLocale());
instance.setTimeZone(getTimeZone());
return instance.format(date);
}
}
return dateFormat.format(date);
}
......@@ -225,8 +269,18 @@ public class JiveGlobals {
* @return a String representing the date and time.
*/
public static String formatDateTime(Date date) {
if (locale == null) {
loadProperties();
if (dateTimeFormat == null) {
if (properties != null) {
dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
DateFormat.MEDIUM, getLocale());
dateTimeFormat.setTimeZone(getTimeZone());
}
else {
DateFormat instance = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
DateFormat.MEDIUM, getLocale());
instance.setTimeZone(getTimeZone());
return instance.format(date);
}
}
return dateTimeFormat.format(date);
}
......@@ -238,14 +292,35 @@ public class JiveGlobals {
*/
public static String getJiveHome() {
if (jiveHome == null) {
loadProperties();
loadSetupProperties();
}
return jiveHome;
}
/**
* Returns a Jive property. Jive properties are stored in the file
* <tt>jive_config.xml</tt> that exists in the <tt>jiveHome</tt> directory.
* Sets the location of the <code>jiveHome</code> directory. This method is only intended to be
* used during setup and should <b>not</b> set called in normal Jive operations.
*/
public static void setJiveHome(String jHome) {
properties = null;
xmlProperties = null;
failedLoading = false;
jiveHome = jHome;
locale = null;
timeZone = null;
characterEncoding = null;
dateFormat = null;
dateTimeFormat = null;
loadSetupProperties();
System.err.println("Warning - jiveHome is being reset to " + jHome +
"! Resetting the jiveHome is a normal part of the setup process, " +
"however it should not occur during the normal operations of Jive.");
}
/**
* Returns a local property. Local properties are stored in the file
* <tt>jive_forums.xml</tt> that exists in the <tt>jiveHome</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file:
* <pre>
......@@ -259,23 +334,22 @@ public class JiveGlobals {
* @param name the name of the property to return.
* @return the property value specified by name.
*/
public static String getJiveProperty(String name) {
if (properties == null) {
loadProperties();
public static String getXMLProperty(String name) {
if (xmlProperties == null) {
loadSetupProperties();
}
// jiveHome not loaded?
if (properties == null) {
if (xmlProperties == null) {
return null;
}
return properties.getProperty(name);
return xmlProperties.getProperty(name);
}
/**
* Sets a Jive property. If the property doesn't already exists, a new
* one will be created. Jive properties are stored in the file
* <tt>jive_config.xml</tt> that exists in the <tt>jiveHome</tt> directory.
* Returns an integer value local property. Local properties are stored in the file
* <tt>jive_forums.xml</tt> that exists in the <tt>jiveHome</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file:
* <pre>
......@@ -286,128 +360,400 @@ public class JiveGlobals {
* &lt;/foo&gt;
* </pre>
*
* @param name the name of the property being set.
* If the specified property can't be found, or if the value is not a number, the
* <tt>defaultValue</tt> will be returned.
*
* @param name the name of the property to return.
* @param defaultValue value returned if the property could not be loaded or was not
* a number.
* @return the property value specified by name or <tt>defaultValue</tt>.
*/
public static int getXMLProperty(String name, int defaultValue) {
String value = getProperty(name);
if (value != null) {
try {
return Integer.parseInt(value);
}
catch (NumberFormatException nfe) { }
}
return defaultValue;
}
/**
* Sets a local property. If the property doesn't already exists, a new
* one will be created. Local properties are stored in the file
* <tt>jive_forums.xml</tt> that exists in the <tt>jiveHome</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file:
* <pre>
* &lt;foo&gt;
* &lt;bar&gt;
* &lt;prop&gt;some value&lt;/prop&gt;
* &lt;/bar&gt;
* &lt;/foo&gt;
* </pre>
*
* @param name the name of the property being set.
* @param value the value of the property being set.
*/
public static void setJiveProperty(String name, String value) {
if (properties == null) {
loadProperties();
public static void setXMLProperty(String name, String value) {
if (xmlProperties == null) {
loadSetupProperties();
}
if (properties != null) {
properties.setProperty(name, value);
// jiveHome not loaded?
if (xmlProperties != null) {
xmlProperties.setProperty(name, value);
}
}
/**
* Deletes a Jive property. If the property doesn't exist, the method
* Sets multiple local properties at once. If a property doesn't already exists, a new
* one will be created. Local properties are stored in the file
* <tt>jive_forums.xml</tt> that exists in the <tt>jiveHome</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file:
* <pre>
* &lt;foo&gt;
* &lt;bar&gt;
* &lt;prop&gt;some value&lt;/prop&gt;
* &lt;/bar&gt;
* &lt;/foo&gt;
* </pre>
*
* @param propertyMap a map of properties, keyed on property name.
*/
public static void setXMLProperties(Map propertyMap) {
if (xmlProperties == null) {
loadSetupProperties();
}
if (xmlProperties != null) {
xmlProperties.setProperties(propertyMap);
}
}
/**
* 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. For example, given
* the properties <tt>X.Y.A</tt>, <tt>X.Y.B</tt>, <tt>X.Y.C</tt> and <tt>X.Y.C.D</tt>, then
* the immediate child properties of <tt>X.Y</tt> are <tt>A</tt>, <tt>B</tt>, and
* <tt>C</tt> (the value of <tt>C.D</tt> would not be returned using this method).<p>
*
* Local properties are stored in the file <tt>jive_forums.xml</tt> that exists
* in the <tt>jiveHome</tt> directory. Properties are always specified as "foo.bar.prop",
* which would map to the following entry in the XML file:
* <pre>
* &lt;foo&gt;
* &lt;bar&gt;
* &lt;prop&gt;some value&lt;/prop&gt;
* &lt;/bar&gt;
* &lt;/foo&gt;
* </pre>
*
*
* @param parent the name of the parent property to return the children for.
* @return all child property values for the given parent.
*/
public static List getXMLProperties(String parent) {
if (xmlProperties == null) {
loadSetupProperties();
}
// jiveHome not loaded?
if (xmlProperties == null) {
return Collections.EMPTY_LIST;
}
String[] propNames = xmlProperties.getChildrenProperties(parent);
List values = new ArrayList();
for (int i = 0; i < propNames.length; i++) {
String propName = propNames[i];
String value = getProperty(parent + "." + propName);
if (value != null) {
values.add(value);
}
}
return values;
}
/**
* Deletes a locale property. If the property doesn't exist, the method
* does nothing.
*
* @param name the name of the property to delete.
*/
public static void deleteJiveProperty(String name) {
public static void deleteXMLProperty(String name) {
if (xmlProperties == null) {
loadSetupProperties();
}
xmlProperties.deleteProperty(name);
}
/**
* Returns a Jive property.
*
* @param name the name of the property to return.
* @return the property value specified by name.
*/
public static String getProperty(String name) {
if (properties == null) {
properties = JiveProperties.getInstance();
}
return (String)properties.get(name);
}
/**
* Returns a Jive property. If the specified property doesn't exist, the
* <tt>defaultValue</tt> will be returned.
*
* @param name the name of the property to return.
* @param defaultValue value returned if the property doesn't exist.
* @return the property value specified by name.
*/
public static String getProperty(String name, String defaultValue) {
if (properties == null) {
properties = JiveProperties.getInstance();
}
String value = (String)properties.get(name);
if (value != null) {
return value;
}
else {
return defaultValue;
}
}
/**
* Returns an integer value Jive property. If the specified property doesn't exist, the
* <tt>defaultValue</tt> will be returned.
*
* @param name the name of the property to return.
* @param defaultValue value returned if the property doesn't exist or was not
* a number.
* @return the property value specified by name or <tt>defaultValue</tt>.
*/
public static int getIntProperty(String name, int defaultValue) {
String value = getProperty(name);
if (value != null) {
try {
return Integer.parseInt(value);
}
catch (NumberFormatException nfe) { }
}
return defaultValue;
}
/**
* Returns a boolean value Jive property.
*
* @param name the name of the property to return.
* @return true if the property value exists and is set to <tt>"true"</tt> (ignoring case).
* Otherwise <tt>false</tt> is returned.
*/
public static boolean getBooleanProperty(String name) {
return Boolean.valueOf(getProperty(name)).booleanValue();
}
/**
* Returns a boolean value Jive property. If the property doesn't exist, the <tt>defaultValue</tt>
* will be returned.
*
* If the specified property can't be found, or if the value is not a number, the
* <tt>defaultValue</tt> will be returned.
*
* @param name the name of the property to return.
* @param defaultValue value returned if the property doesn't exist.
* @return true if the property value exists and is set to <tt>"true"</tt> (ignoring case).
* Otherwise <tt>false</tt> is returned.
*/
public static boolean getBooleanProperty(String name, boolean defaultValue) {
String value = getProperty(name);
if (value != null) {
return Boolean.valueOf(getProperty(name)).booleanValue();
}
else {
return defaultValue;
}
}
/**
* Return all immediate children property names of a parent Jive property as a list of strings,
* or an empty list if there are no children. For example, given
* the properties <tt>X.Y.A</tt>, <tt>X.Y.B</tt>, <tt>X.Y.C</tt> and <tt>X.Y.C.D</tt>, then
* the immediate child properties of <tt>X.Y</tt> are <tt>A</tt>, <tt>B</tt>, and
* <tt>C</tt> (<tt>C.D</tt> would not be returned using this method).<p>
*
* @return a List of all immediate children property names (Strings).
*/
public static List getPropertyNames(String parent) {
if (properties == null) {
properties = JiveProperties.getInstance();
}
return new ArrayList(properties.getChildrenNames(parent));
}
/**
* Return all immediate children property values of a parent Jive property as a list of strings,
* or an empty list if there are no children. For example, given
* the properties <tt>X.Y.A</tt>, <tt>X.Y.B</tt>, <tt>X.Y.C</tt> and <tt>X.Y.C.D</tt>, then
* the immediate child properties of <tt>X.Y</tt> are <tt>X.Y.A</tt>, <tt>X.Y.B</tt>, and
* <tt>X.Y.C</tt> (the value of <tt>X.Y.C.D</tt> would not be returned using this method).<p>
*
* @param parent the name of the parent property to return the children for.
* @return all child property values for the given parent.
*/
public static List getProperties(String parent) {
if (properties == null) {
loadProperties();
properties = JiveProperties.getInstance();
}
Collection propertyNames = properties.getChildrenNames(parent);
List values = new ArrayList();
for (Iterator i=propertyNames.iterator(); i.hasNext(); ) {
String propName = (String)i.next();
String value = getProperty(propName);
if (value != null) {
values.add(value);
}
}
if (properties != null) {
properties.deleteProperty(name);
return values;
}
/**
* Returns all Jive property names.
*
* @return a List of all property names (Strings).
*/
public static List getPropertyNames() {
if (properties == null) {
properties = JiveProperties.getInstance();
}
return new ArrayList(properties.getPropertyNames());
}
/**
* Sets a Jive property. If the property doesn't already exists, a new
* one will be created.
*
* @param name the name of the property being set.
* @param value the value of the property being set.
*/
public static void setProperty(String name, String value) {
if (properties == null) {
properties = JiveProperties.getInstance();
}
properties.put(name, value);
}
/**
* Sets multiple Jive properties at once. If a property doesn't already exists, a new
* one will be created.
*
* @param propertyMap a map of properties, keyed on property name.
*/
public static void setProperties(Map propertyMap) {
if (properties == null) {
properties = JiveProperties.getInstance();
}
properties.putAll(propertyMap);
}
/**
* Deletes a Jive property. If the property doesn't exist, the method
* does nothing. All children of the property will be deleted as well.
*
* @param name the name of the property to delete.
*/
public static void deleteProperty(String name) {
if (properties == null) {
properties = JiveProperties.getInstance();;
}
properties.remove(name);
}
/**
* Allows the name of the local config file name to be changed. The
* default is "jive_startup.xml".
*
* @param configName the name of the config file.
*/
public static void setConfigName(String configName) {
JIVE_CONFIG_FILENAME = configName;
}
/**
* Loads properties if necessary. Property loading must be done lazily so
* that we give outside classes a chance to set <tt>jiveHome</tt>.
*/
private synchronized static void loadProperties() {
private synchronized static void loadSetupProperties() {
if (failedLoading) {
return;
}
if (properties == null) {
// First, try to load it jiveHome as a system property.
if (xmlProperties == null) {
// If jiveHome is still null, no outside process has set it and
// we have to attempt to load the value from jive_init.xml,
// which must be in the classpath.
if (jiveHome == null) {
jiveHome = System.getProperty("jiveHome");
jiveHome = new InitPropLoader().getJiveHome();
}
// If we still don't have jiveHome, let's assume this is standalone
// and just look for jiveHome in a standard sub-dir location and verify
// by looking for the config file
// If that failed, try loading it from JNDI
if (jiveHome == null) {
jiveHome = "..";
// Create a manager with the full path to the xml config file.
try {
properties = new XMLProperties(jiveHome + File.separator +
"config" + File.separator +
JIVE_CONFIG_FILENAME);
}
catch (IOException ioe) {
jiveHome = null;
InitialContext context = new InitialContext();
jiveHome = (String)context.lookup("java:comp/env/jiveHome");
}
catch (Exception e) { }
}
// If jiveHome is still null, no outside process has set it and
// we have to attempt to load the value from messenger_init.xml,
// which must be in the classpath.
// Finally, try to load it jiveHome as a system property.
if (jiveHome == null) {
jiveHome = new InitPropLoader().getJiveHome();
jiveHome = System.getProperty("jiveHome");
}
// If still null, finding jiveHome failed.
if (jiveHome == null) {
Log.error("Jive Home was never set. In order to continue, Jive Home will need to be set");
failedLoading = true;
StringBuffer msg = new StringBuffer();
msg.append("Critical Error! The jiveHome directory could not be loaded, \n");
msg.append("which will prevent the application from working correctly.\n\n");
msg.append("You must set jiveHome in one of four ways:\n");
msg.append(" 1) Set a servlet init parameter named jiveHome.\n");
msg.append(" 2) Add a jive_init.xml file to your classpath, which points \n ");
msg.append(" to jiveHome. Normally, this file will be in WEB-INF/classes.\n");
msg.append(" 3) Set the JNDI value \"java:comp/env/jiveHome\" with a String \n");
msg.append(" that points to your jiveHome directory. \n");
msg.append(" 4) Set the Java system property \"jiveHome\".\n\n");
msg.append("Further instructions for setting jiveHome can be found in the \n");
msg.append("installation documentation.");
System.err.println(msg.toString());
return;
}
else {
// Create a manager with the full path to the xml config file.
try {
properties = new XMLProperties(jiveHome + File.separator +
"config" + File.separator +
JIVE_CONFIG_FILENAME);
// Create a manager with the full path to the xml config file.
try {
// Do a permission check on the jiveHome directory:
File jh = new File(jiveHome);
if (!jh.exists()) {
Log.error("Error - the specified jiveHome directory does not exist (" + jiveHome + ")");
}
catch (IOException ioe) {
Log.error(ioe);
failedLoading = true;
return;
else {
if (!jh.canRead() || !jh.canWrite()) {
Log.error("Error - the user running this Jive application can not read and write to the "
+ "specified jiveHome directory (" + jiveHome + "). Please grant the executing user "
+ "read and write perms.");
}
}
xmlProperties = new XMLProperties(jiveHome + File.separator +
JIVE_CONFIG_FILENAME);
}
}
if (locale == null) {
String language = properties.getProperty("locale.language");
if (language == null) {
language = "";
}
String country = properties.getProperty("locale.country");
if (country == null) {
country = "";
}
// If no locale info is specified, default to system default Locale
if (language.equals("") && country.equals("")) {
locale = Locale.getDefault();
}
else {
locale = new Locale(language, country);
}
String charEncoding = properties.getProperty("locale.characterEncoding");
if (charEncoding != null) {
characterEncoding = charEncoding;
}
else {
// The default encoding is ISO-8859-1. We use the version of
// the encoding name that seems to be most widely compatible.
characterEncoding = "ISO-8859-1";
}
String timeZoneID = properties.getProperty("locale.timeZone");
if (timeZoneID == null) {
timeZone = TimeZone.getDefault();
}
else {
timeZone = TimeZone.getTimeZone(timeZoneID);
catch (IOException ioe) {
Log.error(ioe);
failedLoading = true;
return;
}
dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
DateFormat.MEDIUM, locale);
dateFormat.setTimeZone(timeZone);
dateTimeFormat.setTimeZone(timeZone);
}
}
}
......@@ -453,4 +799,4 @@ class InitPropLoader {
}
return jiveHome;
}
}
}
\ No newline at end of file
......@@ -68,10 +68,10 @@ public abstract class AuthFactory {
// Get the cookie password, stored as a Jive property. Obviously,
// protecting your jive_config.xml file is critical for making cookie
// encryption secure.
String keyString = JiveGlobals.getJiveProperty("cookieKey");
String keyString = JiveGlobals.getProperty("cookieKey");
if (keyString == null) {
keyString = StringUtils.randomString(15);
JiveGlobals.setJiveProperty("cookieKey", keyString);
JiveGlobals.setProperty("cookieKey", keyString);
}
try {
sha = MessageDigest.getInstance("SHA");
......
......@@ -70,7 +70,7 @@ public class AuthProviderFactory {
if (authProvider == null) {
//See if the classname has been set as a Jive property.
String classNameProp =
JiveGlobals.getJiveProperty("AuthProvider.className");
JiveGlobals.getProperty("AuthProvider.className");
if (classNameProp != null) {
authClassName = classNameProp;
}
......@@ -103,7 +103,7 @@ public class AuthProviderFactory {
if (groupProvider == null) {
//See if the classname has been set as a Jive property.
String classNameProp =
JiveGlobals.getJiveProperty("GroupProvider.className");
JiveGlobals.getProperty("GroupProvider.className");
if (classNameProp != null) {
groupClassName = classNameProp;
}
......
......@@ -73,7 +73,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
probeResponse.add(DocumentHelper.createElement("digest"));
}
probeResponse.add(DocumentHelper.createElement("resource"));
anonymousAllowed = "true".equals(JiveGlobals.getJiveProperty("xmpp.auth.anonymous"));
anonymousAllowed = "true".equals(JiveGlobals.getProperty("xmpp.auth.anonymous"));
}
public synchronized IQ handleIQ(IQ packet) throws
......@@ -239,7 +239,7 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
public void setAllowAnonymous(boolean isAnonymous) throws UnauthorizedException {
anonymousAllowed = isAnonymous;
JiveGlobals.setJiveProperty("xmpp.auth.anonymous", anonymousAllowed ? "true" : "false");
JiveGlobals.setProperty("xmpp.auth.anonymous", anonymousAllowed ? "true" : "false");
}
public UserManager userManager;
......
......@@ -148,7 +148,7 @@ public class IQRegisterHandler extends IQHandler implements ServerFeaturesProvid
}
// Check for the default case where no inband property is set and
// make the default true (allowing inband registration)
String inband = JiveGlobals.getJiveProperty("register.inband");
String inband = JiveGlobals.getProperty("register.inband");
if (inband == null || "".equals(inband)) {
setInbandRegEnabled(true);
}
......@@ -367,7 +367,7 @@ public class IQRegisterHandler extends IQHandler implements ServerFeaturesProvid
public void setInbandRegEnabled(boolean allowed) {
enabled = allowed;
JiveGlobals.setJiveProperty("register.inband", enabled ? "true" : "false");
JiveGlobals.setProperty("register.inband", enabled ? "true" : "false");
}
private IQHandler getDelegate(XMPPAddress recipientJID) {
......
......@@ -90,8 +90,8 @@ public class LdapManager {
* constructor is private.
*/
private LdapManager() {
this.host = JiveGlobals.getJiveProperty("ldap.host");
String portStr = JiveGlobals.getJiveProperty("ldap.port");
this.host = JiveGlobals.getProperty("ldap.host");
String portStr = JiveGlobals.getProperty("ldap.port");
if (portStr != null) {
try {
this.port = Integer.parseInt(portStr);
......@@ -99,23 +99,23 @@ public class LdapManager {
catch (NumberFormatException nfe) {
}
}
if (JiveGlobals.getJiveProperty("ldap.usernameField") != null) {
this.usernameField = JiveGlobals.getJiveProperty("ldap.usernameField");
if (JiveGlobals.getProperty("ldap.usernameField") != null) {
this.usernameField = JiveGlobals.getProperty("ldap.usernameField");
}
if (JiveGlobals.getJiveProperty("ldap.baseDN") != null) {
this.baseDN = JiveGlobals.getJiveProperty("ldap.baseDN");
if (JiveGlobals.getProperty("ldap.baseDN") != null) {
this.baseDN = JiveGlobals.getProperty("ldap.baseDN");
}
if (JiveGlobals.getJiveProperty("ldap.nameField") != null) {
this.nameField = JiveGlobals.getJiveProperty("ldap.nameField");
if (JiveGlobals.getProperty("ldap.nameField") != null) {
this.nameField = JiveGlobals.getProperty("ldap.nameField");
}
if (JiveGlobals.getJiveProperty("ldap.emailField") != null) {
this.emailField = JiveGlobals.getJiveProperty("ldap.emailField");
if (JiveGlobals.getProperty("ldap.emailField") != null) {
this.emailField = JiveGlobals.getProperty("ldap.emailField");
}
this.adminDN = JiveGlobals.getJiveProperty("ldap.adminDN");
this.adminPassword = JiveGlobals.getJiveProperty("ldap.adminPassword");
this.debugEnabled = "true".equals(JiveGlobals.getJiveProperty("ldap.debugEnabled"));
this.sslEnabled = "true".equals(JiveGlobals.getJiveProperty("ldap.sslEnabled"));
String modeStr = JiveGlobals.getJiveProperty("ldap.mode");
this.adminDN = JiveGlobals.getProperty("ldap.adminDN");
this.adminPassword = JiveGlobals.getProperty("ldap.adminPassword");
this.debugEnabled = "true".equals(JiveGlobals.getProperty("ldap.debugEnabled"));
this.sslEnabled = "true".equals(JiveGlobals.getProperty("ldap.sslEnabled"));
String modeStr = JiveGlobals.getProperty("ldap.mode");
if (modeStr != null) {
try {
this.mode = Integer.parseInt(modeStr);
......@@ -283,7 +283,7 @@ public class LdapManager {
*/
public void setHost(String host) {
this.host = host;
JiveGlobals.setJiveProperty("ldap.host", host);
JiveGlobals.setProperty("ldap.host", host);
}
/**
......@@ -304,7 +304,7 @@ public class LdapManager {
*/
public void setPort(int port) {
this.port = port;
JiveGlobals.setJiveProperty("ldap.port", "" + port);
JiveGlobals.setProperty("ldap.port", "" + port);
}
/**
......@@ -327,7 +327,7 @@ public class LdapManager {
*/
public void setDebugEnabled(boolean debugEnabled) {
this.debugEnabled = debugEnabled;
JiveGlobals.setJiveProperty("ldap.debuggingEnabled", "" + debugEnabled);
JiveGlobals.setProperty("ldap.debuggingEnabled", "" + debugEnabled);
}
/**
......@@ -368,10 +368,10 @@ public class LdapManager {
public void setUsernameField(String usernameField) {
this.usernameField = usernameField;
if (usernameField == null) {
JiveGlobals.deleteJiveProperty("ldap.usernameField");
JiveGlobals.deleteProperty("ldap.usernameField");
}
else {
JiveGlobals.setJiveProperty("ldap.usernameField", usernameField);
JiveGlobals.setProperty("ldap.usernameField", usernameField);
}
}
......@@ -394,10 +394,10 @@ public class LdapManager {
public void setNameField(String nameField) {
this.nameField = nameField;
if (nameField == null) {
JiveGlobals.deleteJiveProperty("ldap.nameField");
JiveGlobals.deleteProperty("ldap.nameField");
}
else {
JiveGlobals.setJiveProperty("ldap.nameField", nameField);
JiveGlobals.setProperty("ldap.nameField", nameField);
}
}
......@@ -422,10 +422,10 @@ public class LdapManager {
public void setEmailField(String emailField) {
this.emailField = emailField;
if (emailField == null) {
JiveGlobals.deleteJiveProperty("ldap.emailField");
JiveGlobals.deleteProperty("ldap.emailField");
}
else {
JiveGlobals.setJiveProperty("ldap.emailField", emailField);
JiveGlobals.setProperty("ldap.emailField", emailField);
}
}
......@@ -447,7 +447,7 @@ public class LdapManager {
*/
public void setBaseDN(String baseDN) {
this.baseDN = baseDN;
JiveGlobals.setJiveProperty("ldap.baseDN", baseDN);
JiveGlobals.setProperty("ldap.baseDN", baseDN);
}
/**
......@@ -468,7 +468,7 @@ public class LdapManager {
*/
public void setAdminDN(String adminDN) {
this.adminDN = adminDN;
JiveGlobals.setJiveProperty("ldap.adminDN", adminDN);
JiveGlobals.setProperty("ldap.adminDN", adminDN);
}
/**
......@@ -489,7 +489,7 @@ public class LdapManager {
*/
public void setAdminPassword(String adminPassword) {
this.adminPassword = adminPassword;
JiveGlobals.setJiveProperty("ldap.adminPassword", adminPassword);
JiveGlobals.setProperty("ldap.adminPassword", adminPassword);
}
/**
......@@ -514,6 +514,6 @@ public class LdapManager {
*/
public void setMode(int mode) {
this.mode = mode;
JiveGlobals.setJiveProperty("ldap.mode", "" + mode);
JiveGlobals.setProperty("ldap.mode", "" + mode);
}
}
\ No newline at end of file
......@@ -40,36 +40,36 @@ public class SSLConfig {
}
static {
String algorithm = JiveGlobals.getJiveProperty("xmpp.socket.ssl.algorithm");
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm");
if ("".equals(algorithm) || algorithm == null) {
algorithm = "TLS";
}
String storeType = JiveGlobals.getJiveProperty("xmpp.socket.ssl.storeType");
String storeType = JiveGlobals.getProperty("xmpp.socket.ssl.storeType");
if ("".equals(storeType)) {
storeType = null;
}
keystore = JiveGlobals.getJiveProperty("xmpp.socket.ssl.keystore");
keystore = JiveGlobals.getProperty("xmpp.socket.ssl.keystore");
if ("".equals(keystore) || keystore == null) {
keystore = null;
}
else {
keystore = JiveGlobals.getJiveHome() + File.separator + keystore;
}
keypass = JiveGlobals.getJiveProperty("xmpp.socket.ssl.keypass");
keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass");
if (keypass == null) {
keypass = "";
}
else {
keypass = keypass.trim();
}
truststore = JiveGlobals.getJiveProperty("xmpp.socket.ssl.truststore");
truststore = JiveGlobals.getProperty("xmpp.socket.ssl.truststore");
if ("".equals(truststore) || truststore == null) {
truststore = null;
}
else {
truststore = JiveGlobals.getJiveHome() + File.separator + truststore;
}
trustpass = JiveGlobals.getJiveProperty("xmpp.socket.ssl.trustpass");
trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass");
if (trustpass == null) {
trustpass = "";
}
......
......@@ -69,12 +69,12 @@ public class SSLSocketAcceptThread extends Thread {
super("SSL accept");
this.connManager = connManager;
int port = SSLSocketAcceptThread.DEFAULT_PORT;
String portName = JiveGlobals.getJiveProperty("xmpp.socket.ssl.port");
String portName = JiveGlobals.getProperty("xmpp.socket.ssl.port");
if (portName != null) {
port = Integer.parseInt(portName);
}
String interfaceName = JiveGlobals.getJiveProperty("xmpp.socket.ssl.interface");
String interfaceName = JiveGlobals.getProperty("xmpp.socket.ssl.interface");
bindInterface = null;
if (interfaceName != null) {
try {
......
......@@ -59,11 +59,11 @@ public class SocketAcceptThread extends Thread {
super("SAT accept");
this.connManager = connManager;
port = SocketAcceptThread.DEFAULT_PORT;
String portName = JiveGlobals.getJiveProperty("xmpp.socket.plain.port");
String portName = JiveGlobals.getProperty("xmpp.socket.plain.port");
if (portName != null) {
port = Integer.parseInt(portName);
}
String interfaceName = JiveGlobals.getJiveProperty("xmpp.socket.plain.interface");
String interfaceName = JiveGlobals.getProperty("xmpp.socket.plain.interface");
bindInterface = null;
if (interfaceName != null) {
try {
......
......@@ -67,7 +67,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
}
// Now start up the acceptor (and associated read selector)
if ("true".equals(JiveGlobals.getJiveProperty("xmpp.socket.plain.active"))) {
if ("true".equals(JiveGlobals.getProperty("xmpp.socket.plain.active"))) {
socketThread = new SocketAcceptThread(this);
ports.add(new ServerPortImpl(socketThread.getPort(),
serverName,
......@@ -81,11 +81,11 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
params.add(Integer.toString(socketThread.getPort()));
Log.info(LocaleUtils.getLocalizedString("startup.plain", params));
}
if ("true".equals(JiveGlobals.getJiveProperty("xmpp.socket.ssl.active"))) {
if ("true".equals(JiveGlobals.getProperty("xmpp.socket.ssl.active"))) {
try {
sslSocketThread = new SSLSocketAcceptThread(this);
String algorithm =
JiveGlobals.getJiveProperty("xmpp.socket.ssl.algorithm");
JiveGlobals.getProperty("xmpp.socket.ssl.algorithm");
if ("".equals(algorithm) || algorithm == null) {
algorithm = "TLS";
}
......
......@@ -105,7 +105,7 @@ public class UserProviderFactory {
for (int i = 0; i < classNames.length; i++) {
String className = classNames[i];
//See if the classname has been set as a Jive property.
String classNameProp = JiveGlobals.getJiveProperty(propNames[i]);
String classNameProp = JiveGlobals.getProperty(propNames[i]);
if (classNameProp != null) {
className = classNameProp;
}
......
......@@ -63,7 +63,7 @@ public class Log {
*/
public static void initLog() {
try {
logDirectory = JiveGlobals.getLocalProperty("log.directory");
logDirectory = JiveGlobals.getXMLProperty("log.directory");
if (logDirectory == null) {
if (JiveGlobals.getJiveHome() != null) {
File jiveHome = new File(JiveGlobals.getJiveHome());
......@@ -88,21 +88,21 @@ public class Log {
logNameWarn = logDirectory + "jive.warn.log";
logNameError = logDirectory + "jive.error.log";
debugPattern = JiveGlobals.getLocalProperty("log.debug.format");
infoPattern = JiveGlobals.getLocalProperty("log.info.format");
warnPattern = JiveGlobals.getLocalProperty("log.warn.format");
errorPattern = JiveGlobals.getLocalProperty("log.error.format");
debugPattern = JiveGlobals.getXMLProperty("log.debug.format");
infoPattern = JiveGlobals.getXMLProperty("log.info.format");
warnPattern = JiveGlobals.getXMLProperty("log.warn.format");
errorPattern = JiveGlobals.getXMLProperty("log.error.format");
try { maxDebugSize = Long.parseLong(JiveGlobals.getLocalProperty("log.debug.size")); }
try { maxDebugSize = Long.parseLong(JiveGlobals.getXMLProperty("log.debug.size")); }
catch (NumberFormatException e) { /* ignore */ }
try { maxInfoSize = Long.parseLong(JiveGlobals.getLocalProperty("log.info.size")); }
try { maxInfoSize = Long.parseLong(JiveGlobals.getXMLProperty("log.info.size")); }
catch (NumberFormatException e) { /* ignore */ }
try { maxWarnSize = Long.parseLong(JiveGlobals.getLocalProperty("log.warn.size")); }
try { maxWarnSize = Long.parseLong(JiveGlobals.getXMLProperty("log.warn.size")); }
catch (NumberFormatException e) { /* ignore */ }
try { maxErrorSize = Long.parseLong(JiveGlobals.getLocalProperty("log.error.size")); }
try { maxErrorSize = Long.parseLong(JiveGlobals.getXMLProperty("log.error.size")); }
catch (NumberFormatException e) { /* ignore */ }
debugEnabled = "true".equals(JiveGlobals.getLocalProperty("log.debug.enabled"));
debugEnabled = "true".equals(JiveGlobals.getXMLProperty("log.debug.enabled"));
}
catch (Exception e) {
// we'll get an exception if jiveHome isn't setup yet - we ignore that since
......@@ -186,7 +186,7 @@ public class Log {
}
public static void setDebugEnabled(boolean enabled) {
JiveGlobals.setLocalProperty("log.debug.enabled", Boolean.toString(enabled));
JiveGlobals.setXMLProperty("log.debug.enabled", Boolean.toString(enabled));
debugEnabled = enabled;
}
......
......@@ -14,7 +14,7 @@
isErrorPage="true"
%>
<% boolean debug = "true".equals(JiveGlobals.getJiveProperty("skin.default.debug"));
<% boolean debug = "true".equals(JiveGlobals.getProperty("skin.default.debug"));
if (debug) {
exception.printStackTrace();
}
......
......@@ -27,7 +27,7 @@
<%! // List of allowed usernames:
static Map allowedUsernames = null;
static String allowedUsernameProp = JiveGlobals.getJiveProperty("admin.login.allowedUsernames");
static String allowedUsernameProp = JiveGlobals.getProperty("admin.login.allowedUsernames");
static {
if (allowedUsernameProp != null) {
StringTokenizer tokenizer = new StringTokenizer(allowedUsernameProp, ",");
......
......@@ -343,12 +343,12 @@ String log = ParamUtils.getParameter(request, "log");
// Enable/disable debugging
if (request.getParameter("wasDebugEnabled") != null && wasDebugEnabled != debugEnabled) {
JiveGlobals.setJiveProperty("log.debug.enabled",String.valueOf(debugEnabled));
JiveGlobals.setProperty("log.debug.enabled",String.valueOf(debugEnabled));
response.sendRedirect("logviewer.jsp?log=debug&debugAlert=true");
return;
}
debugEnabled = "true".equals(JiveGlobals.getJiveProperty("log.debug.enabled"));
debugEnabled = "true".equals(JiveGlobals.getProperty("log.debug.enabled"));
// Set defaults
if (log == null) {
......
......@@ -24,7 +24,7 @@
<%! // Global vars, methods, etc
void setSetupFinished(HttpSession session) {
JiveGlobals.setJiveProperty("setup","true");
JiveGlobals.setXMLProperty("setup","true");
// update the sidebar status
session.setAttribute("jive.setup.sidebar.4","done");
}
......
......@@ -48,11 +48,11 @@
// if no errors, continue
if (errors.size() == 0) {
// Set the JNDI connection class property in the jive props file
JiveGlobals.setJiveProperty("connectionProvider.className",
JiveGlobals.setProperty("connectionProvider.className",
"org.jivesoftware.database.JNDIDataSourceProvider");
// Save the name (must do this *first* before initializing
// the JNDIDataSourceProvider
JiveGlobals.setJiveProperty("database.JNDIProvider.name",lookupName);
JiveGlobals.setProperty("database.JNDIProvider.name",lookupName);
// Use the Jive default connection provider
JNDIDataSourceProvider conProvider = new JNDIDataSourceProvider();
conProvider.setProperty("name", lookupName);
......
......@@ -43,7 +43,7 @@
}
else if (EMBEDDED.equals(mode)) {
// Set the classname of the provider in the config file:
JiveGlobals.setJiveProperty("connectionProvider.className",
JiveGlobals.setProperty("connectionProvider.className",
"org.jivesoftware.database.EmbeddedConnectionProvider");
ConnectionProvider conProvider = new EmbeddedConnectionProvider();
DbConnectionManager.setConnectionProvider(conProvider);
......
......@@ -74,7 +74,7 @@
// set properties, test connection, etc
// Force the standard jive connection provider to be used by deleting the current setting:
JiveGlobals.setJiveProperty("connectionProvider.className",
JiveGlobals.setProperty("connectionProvider.className",
"org.jivesoftware.database.DefaultConnectionProvider");
DefaultConnectionProvider conProvider = new DefaultConnectionProvider();
try {
......@@ -86,16 +86,16 @@
conProvider.setUsername(username);
conProvider.setPassword(password);
JiveGlobals.setJiveProperty("database.defaultProvider.driver", driver);
JiveGlobals.setJiveProperty("database.defaultProvider.serverURL", serverURL);
JiveGlobals.setJiveProperty("database.defaultProvider.username", username);
JiveGlobals.setJiveProperty("database.defaultProvider.password", password);
JiveGlobals.setProperty("database.defaultProvider.driver", driver);
JiveGlobals.setProperty("database.defaultProvider.serverURL", serverURL);
JiveGlobals.setProperty("database.defaultProvider.username", username);
JiveGlobals.setProperty("database.defaultProvider.password", password);
JiveGlobals.setJiveProperty("database.defaultProvider.minConnections",
JiveGlobals.setProperty("database.defaultProvider.minConnections",
Integer.toString(minConnections));
JiveGlobals.setJiveProperty("database.defaultProvider.maxConnections",
JiveGlobals.setProperty("database.defaultProvider.maxConnections",
Integer.toString(maxConnections));
JiveGlobals.setJiveProperty("database.defaultProvider.connectionTimeout",
JiveGlobals.setProperty("database.defaultProvider.connectionTimeout",
Double.toString(connectionTimeout));
}
catch (Exception e) {
......@@ -118,27 +118,27 @@
if (!doContinue) {
// reset values of jdbc driver from props file
driver = JiveGlobals.getJiveProperty("database.defaultProvider.driver");
serverURL = JiveGlobals.getJiveProperty("database.defaultProvider.serverURL");
username = JiveGlobals.getJiveProperty("database.defaultProvider.username");
password = JiveGlobals.getJiveProperty("database.defaultProvider.password");
driver = JiveGlobals.getProperty("database.defaultProvider.driver");
serverURL = JiveGlobals.getProperty("database.defaultProvider.serverURL");
username = JiveGlobals.getProperty("database.defaultProvider.username");
password = JiveGlobals.getProperty("database.defaultProvider.password");
try {
minConnections = Integer.parseInt(
JiveGlobals.getJiveProperty("database.defaultProvider.minConnections"));
JiveGlobals.getProperty("database.defaultProvider.minConnections"));
}
catch (Exception e) {
minConnections = 5;
}
try {
maxConnections = Integer.parseInt(
JiveGlobals.getJiveProperty("database.defaultProvider.maxConnections"));
JiveGlobals.getProperty("database.defaultProvider.maxConnections"));
}
catch (Exception e) {
maxConnections = 15;
}
try {
connectionTimeout = Double.parseDouble(
JiveGlobals.getJiveProperty("database.defaultProvider.connectionTimeout"));
JiveGlobals.getProperty("database.defaultProvider.connectionTimeout"));
}
catch (Exception e) {
connectionTimeout = 1.0;
......
......@@ -51,13 +51,13 @@
}
// Continue if there were no errors
if (errors.size() == 0) {
JiveGlobals.setJiveProperty("xmpp.domain",domain);
JiveGlobals.setJiveProperty("xmpp.chat.domain",chatDomain);
JiveGlobals.setJiveProperty("xmpp.socket.plain.port",Integer.toString(port));
JiveGlobals.setJiveProperty("embedded-web.port",Integer.toString(embeddedPort));
JiveGlobals.setJiveProperty("xmpp.socket.ssl.active",""+sslEnabled);
JiveGlobals.setJiveProperty("xmpp.socket.ssl.port",Integer.toString(sslPort));
JiveGlobals.setJiveProperty("xmpp.auth.anonymous", "true" );
JiveGlobals.setProperty("xmpp.domain",domain);
JiveGlobals.setProperty("xmpp.chat.domain",chatDomain);
JiveGlobals.setProperty("xmpp.socket.plain.port",Integer.toString(port));
JiveGlobals.setProperty("embedded-web.port",Integer.toString(embeddedPort));
JiveGlobals.setProperty("xmpp.socket.ssl.active",""+sslEnabled);
JiveGlobals.setProperty("xmpp.socket.ssl.port",Integer.toString(sslPort));
JiveGlobals.setProperty("xmpp.auth.anonymous", "true" );
// JiveGlobals.setProperty("xmpp.socket.ssl.storeType",storeType);
// JiveGlobals.setProperty("xmpp.socket.ssl.keystore",keystore);
// JiveGlobals.setProperty("xmpp.socket.ssl.keypass",keypass);
......@@ -76,23 +76,23 @@
// Load the current values:
if (!doContinue) {
domain = JiveGlobals.getJiveProperty("xmpp.domain");
chatDomain = JiveGlobals.getJiveProperty("xmpp.chat.domain");
domain = JiveGlobals.getProperty("xmpp.domain");
chatDomain = JiveGlobals.getProperty("xmpp.chat.domain");
// storeType = JiveGlobals.getProperty("xmpp.socket.ssl.storeType");
// keystore = JiveGlobals.getProperty("xmpp.socket.ssl.keystore");
// keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass");
// truststore = JiveGlobals.getProperty("xmpp.socket.ssl.truststore");
// trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass");
try {
port = Integer.parseInt(JiveGlobals.getJiveProperty("xmpp.socket.plain.port"));
port = Integer.parseInt(JiveGlobals.getProperty("xmpp.socket.plain.port"));
} catch (Exception ignored) {}
try {
embeddedPort = Integer.parseInt(JiveGlobals.getJiveProperty("embedded-web.port"));
embeddedPort = Integer.parseInt(JiveGlobals.getProperty("embedded-web.port"));
} catch (Exception ignored) {}
try {
sslPort = Integer.parseInt(JiveGlobals.getJiveProperty("xmpp.socket.ssl.port"));
sslPort = Integer.parseInt(JiveGlobals.getProperty("xmpp.socket.ssl.port"));
} catch (Exception ignored) {}
sslEnabled = "true".equals(JiveGlobals.getJiveProperty("xmpp.socket.ssl.active"));
sslEnabled = "true".equals(JiveGlobals.getProperty("xmpp.socket.ssl.active"));
// If the domain and chat domain are still blank, guess at their values:
if (domain == null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment