Commit 74bfd449 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Moved JiveGlobals to org.jivesoftware.util and made it more generic. JM-248


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1217 b35dd754-fafc-0310-a699-88a17e54d16e
parent e3fc7827
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
package org.jivesoftware.database; package org.jivesoftware.database;
import org.jivesoftware.util.ClassUtils; import org.jivesoftware.util.ClassUtils;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.JiveGlobals;
import java.io.*; import java.io.*;
import java.sql.*; import java.sql.*;
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
package org.jivesoftware.database; package org.jivesoftware.database;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.JiveGlobals;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;
......
...@@ -11,20 +11,22 @@ ...@@ -11,20 +11,22 @@
package org.jivesoftware.database; package org.jivesoftware.database;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.JiveGlobals;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.sql.*; import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
/** /**
* A connection provider for the embedded hsqlDB database. The database file is stored at * A connection provider for the embedded hsqlDB database. The database file is stored at
* <tt>messengerHome/database</tt>. The log file for this connection provider is stored at * <tt>home/database</tt>. The log file for this connection provider is stored at
* <tt>[messengerHome]/logs/EmbeddedConnectionProvider.log</tt>, so you should ensure * <tt>[home]/logs/EmbeddedConnectionProvider.log</tt>, so you should ensure
* that the <tt>[messengerHome]/logs</tt> directory exists. * that the <tt>[home]/logs</tt> directory exists.
* *
* @author Matt Tucker * @author Matt Tucker
*/ */
...@@ -57,7 +59,7 @@ public class EmbeddedConnectionProvider implements ConnectionProvider { ...@@ -57,7 +59,7 @@ public class EmbeddedConnectionProvider implements ConnectionProvider {
synchronized (initLock) { synchronized (initLock) {
try { try {
String driver = "org.hsqldb.jdbcDriver"; String driver = "org.hsqldb.jdbcDriver";
File databaseDir = new File(JiveGlobals.getMessengerHome(), File.separator + File databaseDir = new File(JiveGlobals.getHomeDirectory(), File.separator +
"embedded-db"); "embedded-db");
boolean initData = false; boolean initData = false;
// If the database doesn't exist, create it. // If the database doesn't exist, create it.
......
...@@ -11,15 +11,15 @@ ...@@ -11,15 +11,15 @@
package org.jivesoftware.database; package org.jivesoftware.database;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.JiveGlobals;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;
/** /**
* An implementation of ConnectionProvider that utilizes a JDBC 2.0 DataSource * An implementation of ConnectionProvider that utilizes a JDBC 2.0 DataSource
......
...@@ -13,6 +13,7 @@ package org.jivesoftware.messenger; ...@@ -13,6 +13,7 @@ package org.jivesoftware.messenger;
import org.jivesoftware.messenger.container.BasicModule; import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.PacketError; import org.xmpp.packet.PacketError;
......
...@@ -15,6 +15,7 @@ import org.jivesoftware.messenger.container.BasicModule; ...@@ -15,6 +15,7 @@ import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.JiveGlobals;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
......
...@@ -33,6 +33,7 @@ import org.jivesoftware.messenger.user.UserNotFoundException; ...@@ -33,6 +33,7 @@ import org.jivesoftware.messenger.user.UserNotFoundException;
import org.jivesoftware.messenger.handler.PresenceUpdateHandler; import org.jivesoftware.messenger.handler.PresenceUpdateHandler;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
......
...@@ -31,6 +31,7 @@ import org.jivesoftware.messenger.net.MulticastDNSService; ...@@ -31,6 +31,7 @@ import org.jivesoftware.messenger.net.MulticastDNSService;
import org.jivesoftware.util.Version; import org.jivesoftware.util.Version;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.database.DbConnectionManager;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.dom4j.Document; import org.dom4j.Document;
...@@ -77,7 +78,7 @@ public class XMPPServer { ...@@ -77,7 +78,7 @@ public class XMPPServer {
private Map<Class,Module> modules = new HashMap<Class,Module>(); private Map<Class,Module> modules = new HashMap<Class,Module>();
/** /**
* Location of the messengerHome directory. All configuration files should be * Location of the home directory. All configuration files should be
* located here. * located here.
*/ */
private File messengerHome; private File messengerHome;
...@@ -161,6 +162,9 @@ public class XMPPServer { ...@@ -161,6 +162,9 @@ public class XMPPServer {
} }
private void initialize() throws FileNotFoundException { private void initialize() throws FileNotFoundException {
// Set the name of the config file
JiveGlobals.setConfigName("jive-messenger.xml");
locateMessenger(); locateMessenger();
name = JiveGlobals.getProperty("xmpp.domain"); name = JiveGlobals.getProperty("xmpp.domain");
...@@ -463,7 +467,7 @@ public class XMPPServer { ...@@ -463,7 +467,7 @@ public class XMPPServer {
*/ */
private void locateMessenger() throws FileNotFoundException { private void locateMessenger() throws FileNotFoundException {
String jiveConfigName = "conf" + File.separator + "jive-messenger.xml"; String jiveConfigName = "conf" + File.separator + "jive-messenger.xml";
// First, try to load it jiveHome as a system property. // First, try to load it messengerHome as a system property.
if (messengerHome == null) { if (messengerHome == null) {
String homeProperty = System.getProperty("messengerHome"); String homeProperty = System.getProperty("messengerHome");
try { try {
...@@ -476,8 +480,8 @@ public class XMPPServer { ...@@ -476,8 +480,8 @@ public class XMPPServer {
} }
} }
// If we still don't have messengerHome, let's assume this is standalone // If we still don't have home, let's assume this is standalone
// and just look for messengerHome in a standard sub-dir location and verify // and just look for home in a standard sub-dir location and verify
// by looking for the config file // by looking for the config file
if (messengerHome == null) { if (messengerHome == null) {
try { try {
...@@ -489,7 +493,7 @@ public class XMPPServer { ...@@ -489,7 +493,7 @@ public class XMPPServer {
} }
} }
// If messengerHome is still null, no outside process has set it and // If home is still null, no outside process has set it and
// we have to attempt to load the value from messenger_init.xml, // we have to attempt to load the value from messenger_init.xml,
// which must be in the classpath. // which must be in the classpath.
if (messengerHome == null) { if (messengerHome == null) {
...@@ -511,7 +515,7 @@ public class XMPPServer { ...@@ -511,7 +515,7 @@ public class XMPPServer {
} }
} }
catch (Exception e) { catch (Exception e) {
System.err.println("Error loading messenger_init.xml to find messengerHome."); System.err.println("Error loading messenger_init.xml to find home.");
e.printStackTrace(); e.printStackTrace();
} }
finally { finally {
...@@ -524,11 +528,11 @@ public class XMPPServer { ...@@ -524,11 +528,11 @@ public class XMPPServer {
} }
if (messengerHome == null) { if (messengerHome == null) {
System.err.println("Could not locate messengerHome"); System.err.println("Could not locate home");
throw new FileNotFoundException(); throw new FileNotFoundException();
} }
else { else {
JiveGlobals.messengerHome = messengerHome.toString(); JiveGlobals.home = messengerHome.toString();
} }
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
package org.jivesoftware.messenger.audit.spi; package org.jivesoftware.messenger.audit.spi;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.messenger.Session; import org.jivesoftware.messenger.Session;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.audit.AuditManager; import org.jivesoftware.messenger.audit.AuditManager;
...@@ -19,6 +18,7 @@ import org.jivesoftware.messenger.audit.Auditor; ...@@ -19,6 +18,7 @@ import org.jivesoftware.messenger.audit.Auditor;
import org.jivesoftware.messenger.container.BasicModule; import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.interceptor.InterceptorManager; import org.jivesoftware.messenger.interceptor.InterceptorManager;
import org.jivesoftware.messenger.interceptor.PacketInterceptor; import org.jivesoftware.messenger.interceptor.PacketInterceptor;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import java.util.Iterator; import java.util.Iterator;
......
...@@ -11,18 +11,19 @@ ...@@ -11,18 +11,19 @@
package org.jivesoftware.messenger.audit.spi; package org.jivesoftware.messenger.audit.spi;
import org.jivesoftware.util.LocaleUtils; import org.dom4j.DocumentFactory;
import org.jivesoftware.util.Log; import org.dom4j.Element;
import org.jivesoftware.messenger.*; import org.dom4j.io.XMLWriter;
import org.jivesoftware.messenger.Session;
import org.jivesoftware.messenger.audit.AuditManager; import org.jivesoftware.messenger.audit.AuditManager;
import org.jivesoftware.messenger.audit.Auditor; import org.jivesoftware.messenger.audit.Auditor;
import org.xmpp.packet.Packet; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.xmpp.packet.IQ;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet;
import org.xmpp.packet.Presence; import org.xmpp.packet.Presence;
import org.xmpp.packet.IQ;
import org.dom4j.io.XMLWriter;
import org.dom4j.Element;
import org.dom4j.DocumentFactory;
import java.io.*; import java.io.*;
import java.util.Date; import java.util.Date;
...@@ -138,7 +139,7 @@ public class AuditorImpl implements Auditor { ...@@ -138,7 +139,7 @@ public class AuditorImpl implements Auditor {
int i; int i;
// Find the next available log file name // Find the next available log file name
for (i = 0; maxCount < 1 || i < maxCount; i++) { for (i = 0; maxCount < 1 || i < maxCount; i++) {
currentAuditFile = new File(JiveGlobals.getMessengerHome() + File.separator + "logs", currentAuditFile = new File(JiveGlobals.getHomeDirectory() + File.separator + "logs",
"jive.audit-" + i + ".log"); "jive.audit-" + i + ".log");
if (!currentAuditFile.exists()) { if (!currentAuditFile.exists()) {
break; break;
...@@ -158,10 +159,10 @@ public class AuditorImpl implements Auditor { ...@@ -158,10 +159,10 @@ public class AuditorImpl implements Auditor {
// Rotate the files // Rotate the files
for (i--; i >= 0; i--) { for (i--; i >= 0; i--) {
String previousName = "jive.audit-" + i + ".log"; String previousName = "jive.audit-" + i + ".log";
File previousFile = new File(JiveGlobals.getMessengerHome() + File.separator + "logs", File previousFile = new File(JiveGlobals.getHomeDirectory() + File.separator + "logs",
previousName); previousName);
previousFile.renameTo(currentAuditFile); previousFile.renameTo(currentAuditFile);
currentAuditFile = new File(JiveGlobals.getMessengerHome() + File.separator + "logs", currentAuditFile = new File(JiveGlobals.getHomeDirectory() + File.separator + "logs",
previousName); previousName);
} }
} }
......
...@@ -11,11 +11,8 @@ ...@@ -11,11 +11,8 @@
package org.jivesoftware.messenger.auth; package org.jivesoftware.messenger.auth;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.*;
import org.jivesoftware.util.Log; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.StringUtils;
import org.jivesoftware.util.ClassUtils;
import org.jivesoftware.messenger.JiveGlobals;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
package org.jivesoftware.messenger.container; package org.jivesoftware.messenger.container;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.mortbay.http.SunJsseListener; import org.mortbay.http.SunJsseListener;
...@@ -73,7 +73,7 @@ public class AdminConsolePlugin implements Plugin { ...@@ -73,7 +73,7 @@ public class AdminConsolePlugin implements Plugin {
try { try {
// Configure logging to a file, creating log dir if needed // Configure logging to a file, creating log dir if needed
System.setProperty("org.apache.commons.logging.LogFactory", "org.mortbay.log.Factory"); System.setProperty("org.apache.commons.logging.LogFactory", "org.mortbay.log.Factory");
File logDir = new File(JiveGlobals.getMessengerHome(), "logs"); File logDir = new File(JiveGlobals.getHomeDirectory(), "logs");
if (!logDir.exists()) { if (!logDir.exists()) {
logDir.mkdirs(); logDir.mkdirs();
} }
...@@ -107,7 +107,7 @@ public class AdminConsolePlugin implements Plugin { ...@@ -107,7 +107,7 @@ public class AdminConsolePlugin implements Plugin {
// Get the keystore location. The default location is security/keystore // Get the keystore location. The default location is security/keystore
String keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore", String keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore",
"resources" + File.separator + "security" + File.separator + "keystore"); "resources" + File.separator + "security" + File.separator + "keystore");
keyStoreLocation = JiveGlobals.getMessengerHome() + File.separator + keyStoreLocation; keyStoreLocation = JiveGlobals.getHomeDirectory() + File.separator + keyStoreLocation;
// Get the keystore password. The default password is "changeit". // Get the keystore password. The default password is "changeit".
String keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit"); String keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit");
...@@ -116,7 +116,7 @@ public class AdminConsolePlugin implements Plugin { ...@@ -116,7 +116,7 @@ public class AdminConsolePlugin implements Plugin {
// Get the truststore location; default at security/truststore // Get the truststore location; default at security/truststore
String trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore", String trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore",
"resources" + File.separator + "security" + File.separator + "truststore"); "resources" + File.separator + "security" + File.separator + "truststore");
trustStoreLocation = JiveGlobals.getMessengerHome() + File.separator + trustStoreLocation = JiveGlobals.getHomeDirectory() + File.separator +
trustStoreLocation; trustStoreLocation;
// Get the truststore passwprd; default is "changeit". // Get the truststore passwprd; default is "changeit".
......
...@@ -22,7 +22,7 @@ import java.io.File; ...@@ -22,7 +22,7 @@ import java.io.File;
* <li>Use the Jive Messenger API to add new functionality to server. * <li>Use the Jive Messenger API to add new functionality to server.
* </ul> * </ul>
* *
* Plugins live in the <tt>plugins</tt> directory of <tt>messengerHome</tt>. Plugins * Plugins live in the <tt>plugins</tt> directory of <tt>home</tt>. Plugins
* that are packaged as JAR files will be automatically expanded into directories. A * that are packaged as JAR files will be automatically expanded into directories. A
* plugin directory should have the following structure: * plugin directory should have the following structure:
* *
......
...@@ -20,39 +20,27 @@ ...@@ -20,39 +20,27 @@
package org.jivesoftware.messenger.container; package org.jivesoftware.messenger.container;
import org.jivesoftware.util.Log; import org.dom4j.Attribute;
import org.jivesoftware.util.Version;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.admin.AdminConsole;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.Attribute;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.jivesoftware.admin.AdminConsole;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.Version;
import java.io.File;
import java.io.FileFilter;
import java.io.*; import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.jar.JarFile;
import java.util.jar.JarEntry;
import java.util.zip.ZipFile;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.ZipFile;
/** /**
* Loads and manages plugins. The <tt>plugins</tt> directory is monitored for any * Loads and manages plugins. The <tt>plugins</tt> directory is monitored for any
......
...@@ -14,7 +14,7 @@ package org.jivesoftware.messenger.container; ...@@ -14,7 +14,7 @@ package org.jivesoftware.messenger.container;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.jivesoftware.messenger.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
...@@ -23,12 +23,7 @@ import javax.servlet.ServletOutputStream; ...@@ -23,12 +23,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -59,7 +54,7 @@ public class PluginServlet extends HttpServlet { ...@@ -59,7 +54,7 @@ public class PluginServlet extends HttpServlet {
static { static {
servlets = new ConcurrentHashMap<String, HttpServlet>(); servlets = new ConcurrentHashMap<String, HttpServlet>();
pluginDirectory = new File(JiveGlobals.getMessengerHome(), "plugins"); pluginDirectory = new File(JiveGlobals.getHomeDirectory(), "plugins");
} }
public void init(ServletConfig config) throws ServletException { public void init(ServletConfig config) throws ServletException {
......
...@@ -11,12 +11,9 @@ ...@@ -11,12 +11,9 @@
package org.jivesoftware.messenger.group; package org.jivesoftware.messenger.group;
import org.jivesoftware.util.Cache; import org.jivesoftware.util.*;
import org.jivesoftware.util.CacheManager;
import org.jivesoftware.util.ClassUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.user.User; import org.jivesoftware.messenger.user.User;
import org.jivesoftware.messenger.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.messenger.event.GroupEventDispatcher; import org.jivesoftware.messenger.event.GroupEventDispatcher;
import java.util.Collection; import java.util.Collection;
......
...@@ -22,6 +22,7 @@ import org.jivesoftware.messenger.user.UserManager; ...@@ -22,6 +22,7 @@ import org.jivesoftware.messenger.user.UserManager;
import org.jivesoftware.messenger.user.UserNotFoundException; import org.jivesoftware.messenger.user.UserNotFoundException;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.stringprep.Stringprep; import org.jivesoftware.stringprep.Stringprep;
import org.jivesoftware.stringprep.StringprepException; import org.jivesoftware.stringprep.StringprepException;
import org.xmpp.packet.IQ; import org.xmpp.packet.IQ;
......
...@@ -28,6 +28,7 @@ import org.jivesoftware.messenger.user.UserAlreadyExistsException; ...@@ -28,6 +28,7 @@ import org.jivesoftware.messenger.user.UserAlreadyExistsException;
import org.jivesoftware.messenger.user.UserManager; import org.jivesoftware.messenger.user.UserManager;
import org.jivesoftware.messenger.user.UserNotFoundException; import org.jivesoftware.messenger.user.UserNotFoundException;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.IQ; import org.xmpp.packet.IQ;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.PacketError; import org.xmpp.packet.PacketError;
......
...@@ -13,34 +13,18 @@ package org.jivesoftware.messenger.launcher; ...@@ -13,34 +13,18 @@ package org.jivesoftware.messenger.launcher;
import org.jdesktop.jdic.tray.SystemTray; import org.jdesktop.jdic.tray.SystemTray;
import org.jdesktop.jdic.tray.TrayIcon; import org.jdesktop.jdic.tray.TrayIcon;
import org.jivesoftware.messenger.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.XMLProperties;
import org.jivesoftware.util.WebManager; import org.jivesoftware.util.WebManager;
import javax.swing.ImageIcon; import org.jivesoftware.util.XMLProperties;
import javax.swing.JButton;
import javax.swing.JDialog; import javax.swing.*;
import javax.swing.JFrame; import java.awt.*;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException;
/** /**
* Graphical launcher for Jive Messenger. * Graphical launcher for Jive Messenger.
...@@ -50,7 +34,7 @@ import java.io.IOException; ...@@ -50,7 +34,7 @@ import java.io.IOException;
public class Launcher { public class Launcher {
private Process messengerd; private Process messengerd;
private String configFile = JiveGlobals.getMessengerHome() + File.separator + "conf" + File.separator + "jive-messenger.xml"; private String configFile = JiveGlobals.getHomeDirectory() + File.separator + "conf" + File.separator + "jive-messenger.xml";
private JPanel toolbar = new JPanel(); private JPanel toolbar = new JPanel();
private ImageIcon offIcon; private ImageIcon offIcon;
...@@ -352,7 +336,7 @@ public class Launcher { ...@@ -352,7 +336,7 @@ public class Launcher {
final SwingWorker installerThread = new SwingWorker() { final SwingWorker installerThread = new SwingWorker() {
public Object construct() { public Object construct() {
File pluginsDir = new File(JiveGlobals.getMessengerHome(), "plugins"); File pluginsDir = new File(JiveGlobals.getHomeDirectory(), "plugins");
String tempName = plugin.getName() + ".part"; String tempName = plugin.getName() + ".part";
File tempPluginsFile = new File(pluginsDir, tempName); File tempPluginsFile = new File(pluginsDir, tempName);
......
...@@ -13,9 +13,9 @@ package org.jivesoftware.messenger.ldap; ...@@ -13,9 +13,9 @@ package org.jivesoftware.messenger.ldap;
import org.jivesoftware.messenger.auth.AuthProvider; import org.jivesoftware.messenger.auth.AuthProvider;
import org.jivesoftware.messenger.auth.UnauthorizedException; import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.util.Cache; import org.jivesoftware.util.Cache;
import org.jivesoftware.util.JiveConstants; import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.StringUtils; import org.jivesoftware.util.StringUtils;
/** /**
......
...@@ -11,16 +11,21 @@ ...@@ -11,16 +11,21 @@
package org.jivesoftware.messenger.ldap; package org.jivesoftware.messenger.ldap;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.messenger.user.UserNotFoundException; import org.jivesoftware.messenger.user.UserNotFoundException;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import java.util.Hashtable; import javax.naming.Context;
import java.net.URLEncoder; import javax.naming.NamingEnumeration;
import javax.naming.*; import javax.naming.NamingException;
import javax.naming.ldap.LdapContext; import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.InitialLdapContext;
import javax.naming.directory.*; import javax.naming.ldap.LdapContext;
import java.net.URLEncoder;
import java.util.Hashtable;
/** /**
* Centralized administration of LDAP connections. The getInstance() method * Centralized administration of LDAP connections. The getInstance() method
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
package org.jivesoftware.messenger.muc; package org.jivesoftware.messenger.muc;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.JiveGlobals;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import java.util.Iterator; import java.util.Iterator;
......
...@@ -40,6 +40,7 @@ import org.jivesoftware.messenger.muc.NotAllowedException; ...@@ -40,6 +40,7 @@ import org.jivesoftware.messenger.muc.NotAllowedException;
import org.jivesoftware.messenger.user.UserNotFoundException; import org.jivesoftware.messenger.user.UserNotFoundException;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.*; import org.xmpp.packet.*;
import org.xmpp.component.ComponentManager; import org.xmpp.component.ComponentManager;
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
package org.jivesoftware.messenger.net; package org.jivesoftware.messenger.net;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.JiveGlobals;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
...@@ -46,7 +47,7 @@ public class SSLConfig { ...@@ -46,7 +47,7 @@ public class SSLConfig {
// Get the keystore location. The default location is security/keystore // Get the keystore location. The default location is security/keystore
keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore", keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore",
"resources" + File.separator + "security" + File.separator + "keystore"); "resources" + File.separator + "security" + File.separator + "keystore");
keyStoreLocation = JiveGlobals.getMessengerHome() + File.separator + keyStoreLocation; keyStoreLocation = JiveGlobals.getHomeDirectory() + File.separator + keyStoreLocation;
// Get the keystore password. The default password is "changeit". // Get the keystore password. The default password is "changeit".
keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit"); keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit");
...@@ -55,7 +56,7 @@ public class SSLConfig { ...@@ -55,7 +56,7 @@ public class SSLConfig {
// Get the truststore location; default at security/truststore // Get the truststore location; default at security/truststore
trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore", trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore",
"resources" + File.separator + "security" + File.separator + "truststore"); "resources" + File.separator + "security" + File.separator + "truststore");
trustStoreLocation = JiveGlobals.getMessengerHome() + File.separator + trustStoreLocation; trustStoreLocation = JiveGlobals.getHomeDirectory() + File.separator + trustStoreLocation;
// Get the truststore passwprd; default is "changeit". // Get the truststore passwprd; default is "changeit".
trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit"); trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit");
......
...@@ -13,6 +13,7 @@ package org.jivesoftware.messenger.net; ...@@ -13,6 +13,7 @@ package org.jivesoftware.messenger.net;
import com.sun.net.ssl.KeyManager; import com.sun.net.ssl.KeyManager;
import com.sun.net.ssl.KeyManagerFactory; import com.sun.net.ssl.KeyManagerFactory;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.security.KeyStore; import java.security.KeyStore;
...@@ -38,7 +39,7 @@ public class SSLJiveKeyManagerFactory { ...@@ -38,7 +39,7 @@ public class SSLJiveKeyManagerFactory {
/** /**
* Creates a KeyManager list which is null if the storeType is null, or * Creates a KeyManager list which is null if the storeType is null, or
* is a standard KeyManager that uses a KeyStore of type storeType, * is a standard KeyManager that uses a KeyStore of type storeType,
* located at 'keystore' location under messengerHome, and uses 'keypass' as * located at 'keystore' location under home, and uses 'keypass' as
* the password for the keystore password and key password. The default * the password for the keystore password and key password. The default
* Jive keystore contains a self-signed X509 certificate pair under the * Jive keystore contains a self-signed X509 certificate pair under the
* alias '127.0.0.1' in a Java KeyStore (JKS) with initial password 'changeit'. * alias '127.0.0.1' in a Java KeyStore (JKS) with initial password 'changeit'.
...@@ -47,7 +48,7 @@ public class SSLJiveKeyManagerFactory { ...@@ -47,7 +48,7 @@ public class SSLJiveKeyManagerFactory {
* the Jive XMPP server security documentation for more information. * the Jive XMPP server security documentation for more information.
* *
* @param storeType The type of keystore (e.g. "JKS") to use or null to indicate no keystore should be used * @param storeType The type of keystore (e.g. "JKS") to use or null to indicate no keystore should be used
* @param keystore The relative location of the keystore under messengerHome * @param keystore The relative location of the keystore under home
* @param keypass The password for the keystore and key * @param keypass The password for the keystore and key
* @return An array of relevant KeyManagers (may be null indicating a default KeyManager should be created) * @return An array of relevant KeyManagers (may be null indicating a default KeyManager should be created)
* @throws NoSuchAlgorithmException If the keystore type doesn't exist (not provided or configured with your JVM) * @throws NoSuchAlgorithmException If the keystore type doesn't exist (not provided or configured with your JVM)
......
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
package org.jivesoftware.messenger.net; package org.jivesoftware.messenger.net;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import com.sun.net.ssl.KeyManagerFactory;
import com.sun.net.ssl.SSLContext; import javax.net.ssl.KeyManagerFactory;
import com.sun.net.ssl.TrustManagerFactory; import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.TrustManagerFactory;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.security.KeyStore; import java.security.KeyStore;
import javax.net.ssl.SSLServerSocketFactory;
/** /**
* Securue socket factory wrapper allowing simple setup of all security * Securue socket factory wrapper allowing simple setup of all security
......
...@@ -13,6 +13,7 @@ package org.jivesoftware.messenger.net; ...@@ -13,6 +13,7 @@ package org.jivesoftware.messenger.net;
import com.sun.net.ssl.TrustManager; import com.sun.net.ssl.TrustManager;
import com.sun.net.ssl.TrustManagerFactory; import com.sun.net.ssl.TrustManagerFactory;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.security.KeyStore; import java.security.KeyStore;
...@@ -39,7 +40,7 @@ public class SSLJiveTrustManagerFactory { ...@@ -39,7 +40,7 @@ public class SSLJiveTrustManagerFactory {
/** /**
* Creates a TrustManager list which is null if the storeType is null, or * Creates a TrustManager list which is null if the storeType is null, or
* is a standard TrustManager that uses a KeyStore of type storeType, * is a standard TrustManager that uses a KeyStore of type storeType,
* located at 'keystore' location under messengerHome, and uses 'keypass' as * located at 'keystore' location under home, and uses 'keypass' as
* the password for the keystore password and key password (note that * the password for the keystore password and key password (note that
* trust managers typically don't need a key password as public keys * trust managers typically don't need a key password as public keys
* are stored in the clear and can be obtained without a key password). * are stored in the clear and can be obtained without a key password).
...@@ -47,7 +48,7 @@ public class SSLJiveTrustManagerFactory { ...@@ -47,7 +48,7 @@ public class SSLJiveTrustManagerFactory {
* as it is not needed (the server does not require client authentication). * as it is not needed (the server does not require client authentication).
* *
* @param storeType The type of keystore (e.g. "JKS") to use or null to indicate no keystore should be used * @param storeType The type of keystore (e.g. "JKS") to use or null to indicate no keystore should be used
* @param truststore The relative location of the keystore under messengerHome * @param truststore The relative location of the keystore under home
* @param trustpass The password for the keystore and key * @param trustpass The password for the keystore and key
* @return An array of relevant KeyManagers (may be null indicating a default KeyManager should be created) * @return An array of relevant KeyManagers (may be null indicating a default KeyManager should be created)
* @throws NoSuchAlgorithmException If the keystore type doesn't exist (not provided or configured with your JVM) * @throws NoSuchAlgorithmException If the keystore type doesn't exist (not provided or configured with your JVM)
......
...@@ -14,7 +14,7 @@ package org.jivesoftware.messenger.net; ...@@ -14,7 +14,7 @@ package org.jivesoftware.messenger.net;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.ConnectionManager; import org.jivesoftware.messenger.ConnectionManager;
import org.jivesoftware.messenger.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.ServerSocket; import java.net.ServerSocket;
......
...@@ -11,10 +11,11 @@ ...@@ -11,10 +11,11 @@
package org.jivesoftware.messenger.net; package org.jivesoftware.messenger.net;
import org.jivesoftware.messenger.ConnectionManager;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.ConnectionManager;
import org.jivesoftware.messenger.JiveGlobals;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.ServerSocket; import java.net.ServerSocket;
......
...@@ -19,6 +19,7 @@ import org.jivesoftware.messenger.net.SocketConnection; ...@@ -19,6 +19,7 @@ import org.jivesoftware.messenger.net.SocketConnection;
import org.jivesoftware.messenger.net.SocketReadThread; import org.jivesoftware.messenger.net.SocketReadThread;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
......
...@@ -13,7 +13,7 @@ package org.jivesoftware.messenger.spi; ...@@ -13,7 +13,7 @@ package org.jivesoftware.messenger.spi;
import org.jivesoftware.util.Version; import org.jivesoftware.util.Version;
import org.jivesoftware.messenger.XMPPServerInfo; import org.jivesoftware.messenger.XMPPServerInfo;
import org.jivesoftware.messenger.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
......
...@@ -11,18 +11,14 @@ ...@@ -11,18 +11,14 @@
package org.jivesoftware.messenger.user; package org.jivesoftware.messenger.user;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.messenger.event.UserEventDispatcher; import org.jivesoftware.messenger.event.UserEventDispatcher;
import org.jivesoftware.util.Cache;
import org.jivesoftware.util.CacheManager;
import org.jivesoftware.util.ClassUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.stringprep.Stringprep; import org.jivesoftware.stringprep.Stringprep;
import org.jivesoftware.stringprep.StringprepException; import org.jivesoftware.stringprep.StringprepException;
import org.jivesoftware.util.*;
import java.util.Collection; import java.util.Collection;
import java.util.Set;
import java.util.Collections; import java.util.Collections;
import java.util.Set;
/** /**
* Manages users, including loading, creating and deleting. * Manages users, including loading, creating and deleting.
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
*/ */
package org.jivesoftware.util; package org.jivesoftware.util;
import org.jivesoftware.messenger.JiveGlobals;
import java.util.*; import java.util.*;
/** /**
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
package org.jivesoftware.util; package org.jivesoftware.util;
import org.jivesoftware.messenger.JiveGlobals;
import java.beans.*; import java.beans.*;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Locale; import java.util.Locale;
......
...@@ -9,38 +9,35 @@ ...@@ -9,38 +9,35 @@
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
*/ */
package org.jivesoftware.messenger; package org.jivesoftware.util;
import org.jivesoftware.util.*; import org.dom4j.Document;
import org.dom4j.io.SAXReader;
import javax.naming.InitialContext;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.*; import java.util.*;
import org.dom4j.Document;
import org.dom4j.io.SAXReader;
import javax.naming.InitialContext;
/** /**
* Controls Jive properties. Jive properties are only meant to be set and retrieved * Controls Jive properties. Jive properties are only meant to be set and retrieved
* by core Jive classes. * by core Jive classes.
* <p/> * <p/>
* The location of the messengerHome directory should be specified one of * The location of the home directory should be specified one of
* three ways: * three ways:
* <ol> * <ol>
* <li>Set a Java system property named <tt>messengerHome</tt> with the full path to your * <li>Set a Java system property named <tt>home</tt> with the full path to your
* messengerHome directory. * home directory.
* <li>Indicate its value in the <tt>messenger_init.xml</tt> file. This * <li>Indicate its value in the <tt>messenger_init.xml</tt> file. This
* is a simple xml file that should look something like:<br> * is a simple xml file that should look something like:<br>
* <tt><messengerHome>c:\JiveMessenger</messengerHome></tt> (Windows) <br> * <tt><home>c:\JiveMessenger</home></tt> (Windows) <br>
* or <br> * or <br>
* <tt><messengerHome>/var/JiveMessenger</messengerHome></tt> (Unix) <p> * <tt><home>/var/JiveMessenger</home></tt> (Unix) <p>
* <p/> * <p/>
* The file must be in your classpath so that it can be loaded by Java's classloader. * The file must be in your classpath so that it can be loaded by Java's classloader.
* <li>Use another class in your VM to set the <tt>JiveGlobals.messengerHome</tt> variable. * <li>Use another class in your VM to set the <tt>JiveGlobals.home</tt> variable.
* This must be done before the rest of Jive starts up, for example: in a servlet that * This must be done before the rest of Jive starts up, for example: in a servlet that
* is set to run as soon as the appserver starts up. * is set to run as soon as the appserver starts up.
* </ol> * </ol>
...@@ -50,13 +47,13 @@ import javax.naming.InitialContext; ...@@ -50,13 +47,13 @@ import javax.naming.InitialContext;
*/ */
public class JiveGlobals { public class JiveGlobals {
private static String JIVE_CONFIG_FILENAME = "jive-messenger.xml"; private static String JIVE_CONFIG_FILENAME = null;
/** /**
* Location of the jiveHome directory. All configuration files should be * Location of the jiveHome directory. All configuration files should be
* located here. * located here.
*/ */
public static String messengerHome = null; public static String home = null;
public static boolean failedLoading = false; public static boolean failedLoading = false;
...@@ -210,41 +207,20 @@ public class JiveGlobals { ...@@ -210,41 +207,20 @@ public class JiveGlobals {
} }
/** /**
* Returns the location of the <code>messengerHome</code> directory. * Returns the location of the <code>home</code> directory.
* *
* @return the location of the messengerHome dir. * @return the location of the home dir.
*/ */
public static String getMessengerHome() { public static String getHomeDirectory() {
if (messengerHome == null) { if (home == null) {
loadSetupProperties(); loadSetupProperties();
} }
return messengerHome; return home;
} }
/** /**
* Sets the location of the <code>messengerHome</code> directory. This method * Returns a local property. Local properties are stored in the file defined in
* is only intended to be used during setup and should <b>not</b> set called * <tt>JIVE_CONFIG_FILENAME</tt> that exists in the <tt>home</tt> directory.
* in normal Messenger operations.
*/
public static void setMessengerHome(String mHome) {
properties = null;
xmlProperties = null;
failedLoading = false;
messengerHome = mHome;
locale = null;
timeZone = null;
dateFormat = null;
dateTimeFormat = null;
loadSetupProperties();
System.err.println("Warning - messengerHome is being reset to " + mHome +
"! Resetting the messengerHome is a normal part of the setup process, " +
"however it should not occur during the normal operations of Jive Messenger.");
}
/**
* Returns a local property. Local properties are stored in the file
* <tt>jive-messenger.xml</tt> that exists in the <tt>jiveMessenger/conf</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to * Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file: * the following entry in the XML file:
* <pre> * <pre>
...@@ -263,7 +239,7 @@ public class JiveGlobals { ...@@ -263,7 +239,7 @@ public class JiveGlobals {
loadSetupProperties(); loadSetupProperties();
} }
// messengerHome not loaded? // home not loaded?
if (xmlProperties == null) { if (xmlProperties == null) {
return null; return null;
} }
...@@ -272,8 +248,8 @@ public class JiveGlobals { ...@@ -272,8 +248,8 @@ public class JiveGlobals {
} }
/** /**
* Returns a local property. Local properties are stored in the file * Returns a local property. Local properties are stored in the file defined in
* <tt>jive-messenger.xml</tt> that exists in the <tt>jiveMessenger/conf</tt> directory. * <tt>JIVE_CONFIG_FILENAME</tt> that exists in the <tt>home</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to * Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file: * the following entry in the XML file:
* <pre> * <pre>
...@@ -295,7 +271,7 @@ public class JiveGlobals { ...@@ -295,7 +271,7 @@ public class JiveGlobals {
loadSetupProperties(); loadSetupProperties();
} }
// messengerHome not loaded? // home not loaded?
if (xmlProperties == null) { if (xmlProperties == null) {
return null; return null;
} }
...@@ -308,8 +284,8 @@ public class JiveGlobals { ...@@ -308,8 +284,8 @@ public class JiveGlobals {
} }
/** /**
* Returns an integer value local property. Local properties are stored in the file * Returns an integer value local property. Local properties are stored in the file defined in
* <tt>jive_forums.xml</tt> that exists in the <tt>jiveHome</tt> directory. * <tt>JIVE_CONFIG_FILENAME</tt> that exists in the <tt>home</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to * Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file: * the following entry in the XML file:
* <pre> * <pre>
...@@ -341,8 +317,8 @@ public class JiveGlobals { ...@@ -341,8 +317,8 @@ public class JiveGlobals {
/** /**
* Sets a local property. If the property doesn't already exists, a new * Sets a local property. If the property doesn't already exists, a new
* one will be created. Local properties are stored in the file * one will be created. Local properties are stored in the file defined in
* <tt>jive_forums.xml</tt> that exists in the <tt>jiveHome</tt> directory. * <tt>JIVE_CONFIG_FILENAME</tt> that exists in the <tt>home</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to * Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file: * the following entry in the XML file:
* <pre> * <pre>
...@@ -369,8 +345,8 @@ public class JiveGlobals { ...@@ -369,8 +345,8 @@ public class JiveGlobals {
/** /**
* Sets multiple local properties at once. If a property doesn't already exists, a new * 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 * one will be created. Local properties are stored in the file defined in
* <tt>jive_forums.xml</tt> that exists in the <tt>jiveHome</tt> directory. * <tt>JIVE_CONFIG_FILENAME</tt> that exists in the <tt>home</tt> directory.
* Properties are always specified as "foo.bar.prop", which would map to * Properties are always specified as "foo.bar.prop", which would map to
* the following entry in the XML file: * the following entry in the XML file:
* <pre> * <pre>
...@@ -400,8 +376,8 @@ public class JiveGlobals { ...@@ -400,8 +376,8 @@ public class JiveGlobals {
* the immediate child properties of <tt>X.Y</tt> are <tt>A</tt>, <tt>B</tt>, and * 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> * <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 * Local properties are stored in the file defined in <tt>JIVE_CONFIG_FILENAME</tt> that exists
* in the <tt>jiveHome</tt> directory. Properties are always specified as "foo.bar.prop", * in the <tt>home</tt> directory. Properties are always specified as "foo.bar.prop",
* which would map to the following entry in the XML file: * which would map to the following entry in the XML file:
* <pre> * <pre>
* &lt;foo&gt; * &lt;foo&gt;
...@@ -669,6 +645,19 @@ public class JiveGlobals { ...@@ -669,6 +645,19 @@ public class JiveGlobals {
JIVE_CONFIG_FILENAME = configName; JIVE_CONFIG_FILENAME = configName;
} }
/**
* Returns the name of the local config file name.
*
* @return the name of the config file.
*/
static String getConfigName() {
if (JIVE_CONFIG_FILENAME == null) {
throw new IllegalStateException("Need to set the configuration filename to use " +
"before sending this message");
};
return JIVE_CONFIG_FILENAME;
}
/** /**
* Returns true if in setup mode. * Returns true if in setup mode.
* *
...@@ -680,7 +669,7 @@ public class JiveGlobals { ...@@ -680,7 +669,7 @@ public class JiveGlobals {
/** /**
* Loads properties if necessary. Property loading must be done lazily so * Loads properties if necessary. Property loading must be done lazily so
* that we give outside classes a chance to set <tt>messengerHome</tt>. * that we give outside classes a chance to set <tt>home</tt>.
*/ */
private synchronized static void loadSetupProperties() { private synchronized static void loadSetupProperties() {
if (failedLoading) { if (failedLoading) {
...@@ -690,27 +679,27 @@ public class JiveGlobals { ...@@ -690,27 +679,27 @@ public class JiveGlobals {
// If jiveHome is still null, no outside process has set it and // If jiveHome is still null, no outside process has set it and
// we have to attempt to load the value from jive_init.xml, // we have to attempt to load the value from jive_init.xml,
// which must be in the classpath. // which must be in the classpath.
if (messengerHome == null) { if (home == null) {
messengerHome = new InitPropLoader().getMessengerHome(); home = new InitPropLoader().getHome();
} }
// If that failed, try loading it from JNDI // If that failed, try loading it from JNDI
if (messengerHome == null) { if (home == null) {
try { try {
InitialContext context = new InitialContext(); InitialContext context = new InitialContext();
messengerHome = (String)context.lookup("java:comp/env/messengerHome"); home = (String)context.lookup("java:comp/env/home");
} }
catch (Exception e) { } catch (Exception e) { }
} }
// Finally, try to load it jiveHome as a system property. // Finally, try to load it jiveHome as a system property.
if (messengerHome == null) { if (home == null) {
messengerHome = System.getProperty("messengerHome"); home = System.getProperty("home");
} }
if(messengerHome == null){ if(home == null){
try { try {
messengerHome = new File("..").getCanonicalPath(); home = new File("..").getCanonicalPath();
if(!new File(messengerHome, "conf/jive-messenger.xml").exists()){ if(!new File(home, "conf/" + getConfigName()).exists()){
messengerHome = null; home = null;
} }
} }
catch (IOException e) { catch (IOException e) {
...@@ -718,11 +707,11 @@ public class JiveGlobals { ...@@ -718,11 +707,11 @@ public class JiveGlobals {
} }
} }
if(messengerHome == null){ if(home == null){
try { try {
messengerHome = new File("").getCanonicalPath(); home = new File("").getCanonicalPath();
if(!new File(messengerHome, "conf/jive-messenger.xml").exists()){ if(!new File(home, "conf/" + getConfigName()).exists()){
messengerHome = null; home = null;
} }
} }
catch (IOException e) { catch (IOException e) {
...@@ -730,20 +719,20 @@ public class JiveGlobals { ...@@ -730,20 +719,20 @@ public class JiveGlobals {
} }
} }
// If still null, finding messengerHome failed. // If still null, finding home failed.
if (messengerHome == null) { if (home == null) {
failedLoading = true; failedLoading = true;
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Critical Error! The messengerHome directory could not be loaded, \n"); msg.append("Critical Error! The home directory could not be loaded, \n");
msg.append("which will prevent the application from working correctly.\n\n"); msg.append("which will prevent the application from working correctly.\n\n");
msg.append("You must set messengerHome in one of four ways:\n"); msg.append("You must set home in one of four ways:\n");
msg.append(" 1) Set a servlet init parameter named messengerHome.\n"); msg.append(" 1) Set a servlet init parameter named home.\n");
msg.append(" 2) Add a messenger_init.xml file to your classpath, which points \n "); msg.append(" 2) Add a messenger_init.xml file to your classpath, which points \n ");
msg.append(" to messengerHome. Normally, this file will be in WEB-INF/classes.\n"); msg.append(" to home. Normally, this file will be in WEB-INF/classes.\n");
msg.append(" 3) Set the JNDI value \"java:comp/env/messengerHome\" with a String \n"); msg.append(" 3) Set the JNDI value \"java:comp/env/home\" with a String \n");
msg.append(" that points to your messengerHome directory. \n"); msg.append(" that points to your home directory. \n");
msg.append(" 4) Set the Java system property \"messengerHome\".\n\n"); msg.append(" 4) Set the Java system property \"home\".\n\n");
msg.append("Further instructions for setting messengerHome can be found in the \n"); msg.append("Further instructions for setting home can be found in the \n");
msg.append("installation documentation."); msg.append("installation documentation.");
System.err.println(msg.toString()); System.err.println(msg.toString());
return; return;
...@@ -751,19 +740,19 @@ public class JiveGlobals { ...@@ -751,19 +740,19 @@ public class JiveGlobals {
// Create a manager with the full path to the xml config file. // Create a manager with the full path to the xml config file.
try { try {
// Do a permission check on the jiveHome directory: // Do a permission check on the jiveHome directory:
File mh = new File(messengerHome); File mh = new File(home);
if (!mh.exists()) { if (!mh.exists()) {
Log.error("Error - the specified messengerHome directory does not exist (" + messengerHome + ")"); Log.error("Error - the specified home directory does not exist (" + home + ")");
} }
else { else {
if (!mh.canRead() || !mh.canWrite()) { if (!mh.canRead() || !mh.canWrite()) {
Log.error("Error - the user running this Jive application can not read and write to the " Log.error("Error - the user running this Jive application can not read and write to the "
+ "specified jiveHome directory (" + messengerHome + "). Please grant the executing user " + "specified jiveHome directory (" + home + "). Please grant the executing user "
+ "read and write perms."); + "read and write perms.");
} }
} }
xmlProperties = new XMLProperties(messengerHome + File.separator + "conf" + xmlProperties = new XMLProperties(home + File.separator + "conf" +
File.separator + JIVE_CONFIG_FILENAME); File.separator + getConfigName());
} }
catch (IOException ioe) { catch (IOException ioe) {
Log.error(ioe); Log.error(ioe);
...@@ -775,40 +764,40 @@ public class JiveGlobals { ...@@ -775,40 +764,40 @@ public class JiveGlobals {
} }
/** /**
* A very small class to load the messenger_init.properties file. The class is * A very small class to load the file defined in JiveGlobals.JIVE_CONFIG_FILENAME. The class is
* needed since loading files from the classpath in a static context often * needed since loading files from the classpath in a static context often
* fails. * fails.
*/ */
class InitPropLoader { class InitPropLoader {
public String getMessengerHome() { public String getHome() {
String messengerHome = null; String home = null;
InputStream in = null; InputStream in = null;
try { try {
in = getClass().getResourceAsStream("/messenger_init.xml"); in = getClass().getResourceAsStream("/" + JiveGlobals.getConfigName());
if (in != null) { if (in != null) {
SAXReader reader = new SAXReader(); SAXReader reader = new SAXReader();
Document doc = reader.read(in); Document doc = reader.read(in);
messengerHome = doc.getRootElement().getText(); home = doc.getRootElement().getText();
} }
} }
catch (Exception e) { catch (Exception e) {
Log.error("Error loading messenger_init.xml to find messengerHome.", e); Log.error("Error loading messenger_init.xml to find home.", e);
} }
finally { finally {
try { if (in != null) { in.close(); } } try { if (in != null) { in.close(); } }
catch (Exception e) { } catch (Exception e) { }
} }
if (messengerHome != null) { if (home != null) {
messengerHome = messengerHome.trim(); home = home.trim();
// Remove trailing slashes. // Remove trailing slashes.
while (messengerHome.endsWith("/") || messengerHome.endsWith("\\")) { while (home.endsWith("/") || home.endsWith("\\")) {
messengerHome = messengerHome.substring(0, messengerHome.length() - 1); home = home.substring(0, home.length() - 1);
} }
} }
if ("".equals(messengerHome)) { if ("".equals(home)) {
messengerHome = null; home = null;
} }
return messengerHome; return home;
} }
} }
\ No newline at end of file
...@@ -16,7 +16,6 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -16,7 +16,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.sql.*; import java.sql.*;
import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.messenger.event.PropertyEventDispatcher;
/** /**
* Retrieves and stores Jive properties. Properties are stored in the database. * Retrieves and stores Jive properties. Properties are stored in the database.
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
package org.jivesoftware.util; package org.jivesoftware.util;
import org.jivesoftware.messenger.JiveGlobals;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.jsp.jstl.core.Config; import javax.servlet.jsp.jstl.core.Config;
import java.io.IOException; import java.io.IOException;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
package org.jivesoftware.util; package org.jivesoftware.util;
import org.jivesoftware.messenger.JiveGlobals;
import java.text.*; import java.text.*;
import java.util.*; import java.util.*;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
package org.jivesoftware.util; package org.jivesoftware.util;
import org.jivesoftware.messenger.JiveGlobals;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
......
...@@ -11,12 +11,14 @@ ...@@ -11,12 +11,14 @@
package org.jivesoftware.util; package org.jivesoftware.util;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import org.dom4j.Element;
import org.dom4j.Document;
import org.dom4j.io.*;
import org.jivesoftware.messenger.event.PropertyEventDispatcher;
/** /**
* Provides the the ability to use simple XML property files. Each property is * Provides the the ability to use simple XML property files. Each property is
......
...@@ -14,13 +14,14 @@ package org.jivesoftware.messenger.plugin; ...@@ -14,13 +14,14 @@ package org.jivesoftware.messenger.plugin;
import org.jivesoftware.messenger.container.Plugin; import org.jivesoftware.messenger.container.Plugin;
import org.jivesoftware.messenger.container.PluginManager; import org.jivesoftware.messenger.container.PluginManager;
import org.jivesoftware.messenger.*; import org.jivesoftware.messenger.*;
import org.jivesoftware.messenger.event.PropertyEventListener; import org.jivesoftware.util.PropertyEventListener;
import org.jivesoftware.messenger.event.PropertyEventDispatcher; import org.jivesoftware.util.PropertyEventDispatcher;
import org.jivesoftware.messenger.auth.UnauthorizedException; import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.group.GroupManager; import org.jivesoftware.messenger.group.GroupManager;
import org.jivesoftware.messenger.group.Group; import org.jivesoftware.messenger.group.Group;
import org.jivesoftware.messenger.group.GroupNotFoundException; import org.jivesoftware.messenger.group.GroupNotFoundException;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import org.xmpp.packet.PacketError; import org.xmpp.packet.PacketError;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<%@ page import="java.io.*, <%@ page import="java.io.*,
org.jivesoftware.util.ParamUtils, org.jivesoftware.util.ParamUtils,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.user.UserNotFoundException, org.jivesoftware.messenger.user.UserNotFoundException,
org.jivesoftware.messenger.group.GroupNotFoundException" org.jivesoftware.messenger.group.GroupNotFoundException"
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
<tr> <tr>
<td class="c1"><fmt:message key="index.home" /></td> <td class="c1"><fmt:message key="index.home" /></td>
<td class="c2"> <td class="c2">
<%= JiveGlobals.getMessengerHome() %> <%= JiveGlobals.getHomeDirectory() %>
</td> </td>
</tr> </tr>
<tr> <tr>
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
org.jivesoftware.messenger.auth.AuthToken, org.jivesoftware.messenger.auth.AuthToken,
org.jivesoftware.messenger.auth.AuthFactory, org.jivesoftware.messenger.auth.AuthFactory,
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.util.Log, org.jivesoftware.util.Log,
org.jivesoftware.admin.AdminConsole" org.jivesoftware.admin.AdminConsole,
org.jivesoftware.util.JiveGlobals"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
java.text.*, java.text.*,
org.jivesoftware.util.log.Logger, org.jivesoftware.util.log.Logger,
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*,
java.util.*, java.util.*,
org.jivesoftware.admin.AdminPageBean" org.jivesoftware.admin.AdminPageBean"
...@@ -150,16 +150,16 @@ ...@@ -150,16 +150,16 @@
} }
else if (markLog && log != null) { else if (markLog && log != null) {
if ("error".equals(log)) { if ("error".equals(log)) {
Log.markErrorLogFile(pageUser); Log.markErrorLogFile(pageUser.getUsername());
} }
else if ("warn".equals(log)) { else if ("warn".equals(log)) {
Log.markWarnLogFile(pageUser); Log.markWarnLogFile(pageUser.getUsername());
} }
else if ("info".equals(log)) { else if ("info".equals(log)) {
Log.markInfoLogFile(pageUser); Log.markInfoLogFile(pageUser.getUsername());
} }
else if ("debug".equals(log)) { else if ("debug".equals(log)) {
Log.markDebugLogFile(pageUser); Log.markDebugLogFile(pageUser.getUsername());
} }
response.sendRedirect("logviewer.jsp?log=" + log); response.sendRedirect("logviewer.jsp?log=" + log);
return; return;
...@@ -431,7 +431,7 @@ IFRAME { ...@@ -431,7 +431,7 @@ IFRAME {
<br> <br>
<span class="jive-description" style="color:#666;"> <span class="jive-description" style="color:#666;">
Log dir: <%= JiveGlobals.getMessengerHome() %><%= File.separator %>logs Log dir: <%= JiveGlobals.getHomeDirectory() %><%= File.separator %>logs
</span> </span>
<br><br> <br><br>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
org.jivesoftware.messenger.XMPPServerInfo, org.jivesoftware.messenger.XMPPServerInfo,
org.jivesoftware.messenger.muc.MultiUserChatServer, org.jivesoftware.messenger.muc.MultiUserChatServer,
org.jivesoftware.admin.*, org.jivesoftware.admin.*,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
java.util.*, java.util.*,
org.jivesoftware.util.LocaleUtils" org.jivesoftware.util.LocaleUtils"
errorPage="error.jsp" errorPage="error.jsp"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
java.util.*, java.util.*,
org.jivesoftware.util.*, org.jivesoftware.util.*,
org.jivesoftware.util.ParamUtils, org.jivesoftware.util.ParamUtils,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.admin.AdminPageBean" org.jivesoftware.admin.AdminPageBean"
errorPage="error.jsp" errorPage="error.jsp"
%> %>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
java.util.*, java.util.*,
org.jivesoftware.messenger.XMPPServer, org.jivesoftware.messenger.XMPPServer,
java.net.InetAddress, java.net.InetAddress,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.messenger.net.SSLSocketAcceptThread, org.jivesoftware.messenger.net.SSLSocketAcceptThread,
org.jivesoftware.messenger.net.SocketAcceptThread" org.jivesoftware.messenger.net.SocketAcceptThread"
%> %>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.auth.AuthFactory, org.jivesoftware.messenger.auth.AuthFactory,
org.jivesoftware.messenger.auth.AuthToken, org.jivesoftware.messenger.auth.AuthToken,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.messenger.auth.DefaultAuthProvider" %> org.jivesoftware.messenger.auth.DefaultAuthProvider" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
javax.naming.NamingEnumeration, javax.naming.NamingEnumeration,
javax.naming.InitialContext, javax.naming.InitialContext,
javax.naming.Binding, javax.naming.Binding,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.database.JNDIDataSourceProvider, org.jivesoftware.database.JNDIDataSourceProvider,
org.jivesoftware.database.DbConnectionManager, org.jivesoftware.database.DbConnectionManager,
org.jivesoftware.database.JNDIDataSourceProvider" %> org.jivesoftware.database.JNDIDataSourceProvider" %>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
--%> --%>
<%@ page import="org.jivesoftware.util.ParamUtils, <%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
org.jivesoftware.database.EmbeddedConnectionProvider, org.jivesoftware.database.EmbeddedConnectionProvider,
org.jivesoftware.database.DbConnectionManager, org.jivesoftware.database.DbConnectionManager,
org.jivesoftware.database.ConnectionProvider, org.jivesoftware.database.ConnectionProvider,
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
// Defaults // Defaults
if (mode == null) { if (mode == null) {
// If the "embedded-database" directory exists, select to the embedded db as the default. // If the "embedded-database" directory exists, select to the embedded db as the default.
if (new File(JiveGlobals.getMessengerHome(), "embedded-db").exists()) { if (new File(JiveGlobals.getHomeDirectory(), "embedded-db").exists()) {
mode = EMBEDDED; mode = EMBEDDED;
} }
// Otherwise default to standard. // Otherwise default to standard.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
java.beans.BeanInfo, java.beans.BeanInfo,
java.beans.Introspector, java.beans.Introspector,
java.beans.PropertyDescriptor, java.beans.PropertyDescriptor,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
java.sql.Connection, java.sql.Connection,
java.io.File, java.io.File,
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
} }
catch (Exception e) { catch (Exception e) {
errors.put("general","Setting connection properties failed - please see the error " errors.put("general","Setting connection properties failed - please see the error "
+ "log located in messengerHome/logs for more details."); + "log located in home/logs for more details.");
Log.error(e); Log.error(e);
} }
// No errors setting the properties, so test the connection // No errors setting the properties, so test the connection
......
<%-- <%--
- $RCSfile$ - $RCSfile$
- $Revision$ - $Revision$
- $Date$ - $Date$
--%> --%>
<%@ page import="java.lang.reflect.Method, <%@ page import="java.lang.reflect.Method,
java.io.File, java.io.File,
org.jivesoftware.util.LocaleUtils" %> org.jivesoftware.util.LocaleUtils" %>
<%-- note, the loadClass method is defined in setup-global.jspf --%> <%-- note, the loadClass method is defined in setup-global.jspf --%>
<% // Check the user's environment for minimum requirements. <% // Check the user's environment for minimum requirements.
boolean jdk13Installed = false; boolean jdk13Installed = false;
boolean servlet22Installed = false; boolean servlet22Installed = false;
boolean jsp11Installed = false; boolean jsp11Installed = false;
boolean jiveJarsInstalled = false; boolean jiveJarsInstalled = false;
boolean messengerHomeExists = false; boolean messengerHomeExists = false;
File messengerHome = null; File messengerHome = null;
// Check for JDK 1.5 // Check for JDK 1.5
try { try {
loadClass("java.util.concurrent.ConcurrentHashMap"); loadClass("java.util.concurrent.ConcurrentHashMap");
jdk13Installed = true; jdk13Installed = true;
} }
catch (ClassNotFoundException cnfe) {} catch (ClassNotFoundException cnfe) {}
// Check for Servlet 2.3: // Check for Servlet 2.3:
try { try {
Class c = loadClass("javax.servlet.http.HttpSession"); Class c = loadClass("javax.servlet.http.HttpSession");
Method m = c.getMethod("getAttribute",new Class[]{String.class}); Method m = c.getMethod("getAttribute",new Class[]{String.class});
servlet22Installed = true; servlet22Installed = true;
} }
catch (ClassNotFoundException cnfe) {} catch (ClassNotFoundException cnfe) {}
// Check for JSP 1.1: // Check for JSP 1.1:
try { try {
loadClass("javax.servlet.jsp.tagext.Tag"); loadClass("javax.servlet.jsp.tagext.Tag");
jsp11Installed = true; jsp11Installed = true;
} }
catch (ClassNotFoundException cnfe) {} catch (ClassNotFoundException cnfe) {}
// Check that the Messenger jar are installed: // Check that the Messenger jar are installed:
try { try {
loadClass("org.jivesoftware.messenger.XMPPServer"); loadClass("org.jivesoftware.messenger.XMPPServer");
jiveJarsInstalled = true; jiveJarsInstalled = true;
} }
catch (ClassNotFoundException cnfe) {} catch (ClassNotFoundException cnfe) {}
// Try to determine what the jiveHome directory is: // Try to determine what the jiveHome directory is:
try { try {
Class jiveGlobalsClass = loadClass("org.jivesoftware.messenger.JiveGlobals");
Method getMessengerHomeMethod = jiveGlobalsClass.getMethod("getMessengerHome", (Class[])null); Class jiveGlobalsClass = loadClass("org.jivesoftware.util.JiveGlobals");
Method getMessengerHomeMethod = jiveGlobalsClass.getMethod("getHomeDirectory", (Class[])null);
String messengerHomeProp = (String)getMessengerHomeMethod.invoke(jiveGlobalsClass, (Object[])null); String messengerHomeProp = (String)getMessengerHomeMethod.invoke(jiveGlobalsClass, (Object[])null);
if (messengerHomeProp != null) { if (messengerHomeProp != null) {
messengerHome = new File(messengerHomeProp); messengerHome = new File(messengerHomeProp);
if (messengerHome.exists()) { if (messengerHome.exists()) {
messengerHomeExists = true; messengerHomeExists = true;
} }
} }
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
// If there were no errors, redirect to the main setup page // If there were no errors, redirect to the main setup page
if (!jdk13Installed || !servlet22Installed || !jsp11Installed || !jiveJarsInstalled if (!jdk13Installed || !servlet22Installed || !jsp11Installed || !jiveJarsInstalled
|| !messengerHomeExists) || !messengerHomeExists)
{ {
%> %>
<html> <html>
<head> <head>
<title><fmt:message key="title" /> <fmt:message key="setup.title" /></title> <title><fmt:message key="title" /> <fmt:message key="setup.title" /></title>
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<p class="jive-setup-page-header"> <p class="jive-setup-page-header">
<fmt:message key="title" /> <fmt:message key="setup.title" /> <fmt:message key="title" /> <fmt:message key="setup.title" />
</p> </p>
<p class="jive-setup-error-text"> <p class="jive-setup-error-text">
<fmt:message key="setup.env.check.error" /> <fmt:message key="title" /> <fmt:message key="setup.title" />. <fmt:message key="setup.env.check.error" /> <fmt:message key="title" /> <fmt:message key="setup.title" />.
</p> </p>
<p> <p>
<fmt:message key="setup.env.check.error_info"> <fmt:message key="setup.env.check.error_info">
<fmt:param value="<%= LocaleUtils.getLocalizedString("title") %>" /> <fmt:param value="<%= LocaleUtils.getLocalizedString("title") %>" />
</fmt:message> </fmt:message>
</p> </p>
<ul> <ul>
<table cellpadding="3" cellspacing="2" border="0"> <table cellpadding="3" cellspacing="2" border="0">
<% if (jdk13Installed) { %> <% if (jdk13Installed) { %>
<tr> <tr>
<td><img src="images/check.gif" width="13" height="13" border="0"></td> <td><img src="images/check.gif" width="13" height="13" border="0"></td>
<td> <td>
<fmt:message key="setup.env.check.jdk" /> <fmt:message key="setup.env.check.jdk" />
</td> </td>
</tr> </tr>
<% } else { %> <% } else { %>
<tr> <tr>
<td><img src="images/x.gif" width="13" height="13" border="0"></td> <td><img src="images/x.gif" width="13" height="13" border="0"></td>
<td> <td>
<span class="jive-setup-error-text"> <span class="jive-setup-error-text">
<fmt:message key="setup.env.check.jdk" /> <fmt:message key="setup.env.check.jdk" />
</span> </span>
</td> </td>
</tr> </tr>
<% } <% }
if (servlet22Installed) { if (servlet22Installed) {
%> %>
<tr> <tr>
<td><img src="images/check.gif" width="13" height="13" border="0"></td> <td><img src="images/check.gif" width="13" height="13" border="0"></td>
<td> <td>
<fmt:message key="setup.env.check.servlet" /> <fmt:message key="setup.env.check.servlet" />
</td> </td>
</tr> </tr>
<% } else { %> <% } else { %>
<tr> <tr>
<td><img src="images/x.gif" width="13" height="13" border="0"></td> <td><img src="images/x.gif" width="13" height="13" border="0"></td>
<td> <td>
<span class="jive-setup-error-text"> <span class="jive-setup-error-text">
<fmt:message key="setup.env.check.servlet" /> <fmt:message key="setup.env.check.servlet" />
</span> </span>
</td> </td>
</tr> </tr>
<% } <% }
if (jsp11Installed) { if (jsp11Installed) {
%> %>
<tr> <tr>
<td><img src="images/check.gif" width="13" height="13" border="0"></td> <td><img src="images/check.gif" width="13" height="13" border="0"></td>
<td> <td>
<fmt:message key="setup.env.check.jsp" /> <fmt:message key="setup.env.check.jsp" />
</td> </td>
</tr> </tr>
<% } else { %> <% } else { %>
<tr> <tr>
<td><img src="images/x.gif" width="13" height="13" border="0"></td> <td><img src="images/x.gif" width="13" height="13" border="0"></td>
<td> <td>
<span class="jive-setup-error-text"> <span class="jive-setup-error-text">
<fmt:message key="setup.env.check.jsp" /> <fmt:message key="setup.env.check.jsp" />
</span> </span>
</td> </td>
</tr> </tr>
<% } <% }
if (jiveJarsInstalled) { if (jiveJarsInstalled) {
%> %>
<tr> <tr>
<td><img src="images/check.gif" width="13" height="13" border="0"></td> <td><img src="images/check.gif" width="13" height="13" border="0"></td>
<td> <td>
<fmt:message key="title" /> <fmt:message key="setup.env.check.class" /> <fmt:message key="title" /> <fmt:message key="setup.env.check.class" />
</td> </td>
</tr> </tr>
<% } else { %> <% } else { %>
<tr> <tr>
<td><img src="images/x.gif" width="13" height="13" border="0"></td> <td><img src="images/x.gif" width="13" height="13" border="0"></td>
<td> <td>
<span class="jive-setup-error-text"> <span class="jive-setup-error-text">
<fmt:message key="title" /> <fmt:message key="setup.env.check.class" /> <fmt:message key="title" /> <fmt:message key="setup.env.check.class" />
</span> </span>
</td> </td>
</tr> </tr>
<% } <% }
if (messengerHomeExists) { if (messengerHomeExists) {
%> %>
<tr> <tr>
<td><img src="images/x.gif" width="13" height="13" border="0"></td> <td><img src="images/x.gif" width="13" height="13" border="0"></td>
<td> <td>
<span class="jive-setup-error-text"> <span class="jive-setup-error-text">
<fmt:message key="setup.env.check.jive" /> (<%= messengerHome.toString() %>) <fmt:message key="setup.env.check.jive" /> (<%= messengerHome.toString() %>)
</span> </span>
</td> </td>
</tr> </tr>
<% } else { %> <% } else { %>
<tr> <tr>
<td><img src="images/x.gif" width="13" height="13" border="0"></td> <td><img src="images/x.gif" width="13" height="13" border="0"></td>
<td> <td>
<span class="jive-setup-error-text"> <span class="jive-setup-error-text">
<fmt:message key="setup.env.check.not_home" /> <fmt:message key="setup.env.check.not_home" />
</span> </span>
</td> </td>
</tr> </tr>
<% } %> <% } %>
</table> </table>
</ul> </ul>
<p> <p>
<fmt:message key="setup.env.check.doc" /> <fmt:message key="setup.env.check.doc" />
</p> </p>
</body> </body>
</html> </html>
<% // return so we stop showing the page: <% // return so we stop showing the page:
return; return;
} }
%> %>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<%@ page import="org.jivesoftware.util.ParamUtils, <%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
java.util.Map, java.util.Map,
java.util.Iterator, java.util.Iterator,
org.jivesoftware.messenger.ConnectionManager, org.jivesoftware.messenger.ConnectionManager,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
--%> --%>
<%@ page import="org.jivesoftware.util.ParamUtils, <%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
java.util.Map, java.util.Map,
java.util.HashMap, java.util.HashMap,
java.net.InetAddress" java.net.InetAddress"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
--%> --%>
<%@ page import="org.jivesoftware.util.ParamUtils, <%@ page import="org.jivesoftware.util.ParamUtils,
org.jivesoftware.messenger.JiveGlobals, org.jivesoftware.util.JiveGlobals,
java.util.*" %> java.util.*" %>
<%! // Global vars, methods, etc <%! // Global vars, methods, etc
......
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