Commit 305a0f05 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Code cleanup.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@155 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3f70f554
......@@ -158,4 +158,4 @@ muc.form.conf.owner_roomowners=Room Owners
# Messenger
short.title = Jive Messenger
title = Jive Messenger Server
\ No newline at end of file
title = Jive Messenger
\ No newline at end of file
......@@ -16,6 +16,6 @@ setup.error.messenger_config_file_no_perms=Your appserver does not have permissi
setup.error.main.general=Before setup can continue you need to fix the errors listed below.
setup.error.usersystem.invalid_mode=Invalid mode - please choose a valid user/group/authentication mode below.
setup.error.usersystem.invalid_mode=Invalid mode -- please choose a valid user/group/authentication mode below.
setup.error.datasource.invalid_mode=Invalid mode - please choose a valid datasource mode below.
setup.error.datasource.invalid_mode=Invalid mode -- please choose a valid datasource mode below.
......@@ -88,8 +88,4 @@ public class XMPPBootContainer extends BootstrapContainer {
IQDiscoItemsHandler.class.getName(),
MultiUserChatServerImpl.class.getName()};
}
protected String getFileCoreName() {
return "messenger";
}
}
}
\ No newline at end of file
......@@ -17,10 +17,7 @@ import org.jivesoftware.util.*;
import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.lang.reflect.Method;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
......@@ -106,19 +103,6 @@ public abstract class BootstrapContainer implements Container, ServiceLookupProv
*/
protected abstract String[] getStandardModuleNames();
/**
* <p>Obtain the short filename to be used in the license and
* configuration full filename.</p>
* <p/>
* <p>The file name is typically the 'bare' product name (e.g.
* messenger, nntp, etc). The license file name will become
* <tt>jive_name.license</tt> and the config file <tt>jive-name.xml</tt> and are
* located in the <tt>config</tt> directory.</p>
*
* @return The name used to generate
*/
protected abstract String getFileCoreName();
/**
* The lookup for the bootstrap container.
*/
......@@ -132,7 +116,7 @@ public abstract class BootstrapContainer implements Container, ServiceLookupProv
/**
* All modules loaded by this container
*/
private List modules = new ArrayList();
private List<Module> modules = new ArrayList<Module>();
/**
* Location of the messengerHome directory. All configuration files should be
......@@ -166,7 +150,6 @@ public abstract class BootstrapContainer implements Container, ServiceLookupProv
*/
private void start() {
try {
// Let's specify jive_messenger.xml as the new config file.
locateMessenger();
if ("true".equals(JiveGlobals.getXMLProperty("setup"))) {
setupMode = false;
......@@ -285,18 +268,15 @@ public abstract class BootstrapContainer implements Container, ServiceLookupProv
* start them.</p>
*/
private void startCorePlugins() {
Iterator modIter = modules.iterator();
while (modIter.hasNext()) {
for (Module module : modules) {
boolean started = false;
Module mod = null;
try {
mod = (Module)modIter.next();
mod.start();
module.start();
}
catch (Exception e) {
if (started && mod != null) {
mod.stop();
mod.destroy();
if (started && module != null) {
module.stop();
module.destroy();
}
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
......@@ -541,7 +521,7 @@ public abstract class BootstrapContainer implements Container, ServiceLookupProv
* @throws FileNotFoundException If jiveHome could not be located
*/
private void locateMessenger() throws FileNotFoundException {
String jiveConfigName = "conf" + File.separator + "jive-" + getFileCoreName() + ".xml";
String jiveConfigName = "conf" + File.separator + "jive-messenger.xml";
// First, try to load it jiveHome as a system property.
if (messengerHome == null) {
String homeProperty = System.getProperty("messengerHome");
......@@ -560,10 +540,12 @@ public abstract class BootstrapContainer implements Container, ServiceLookupProv
// by looking for the config file
if (messengerHome == null) {
try {
messengerHome = verifyHome("..", jiveConfigName);
messengerHome = verifyHome("..", jiveConfigName).getCanonicalFile();
}
catch (FileNotFoundException fe) {
}
catch (IOException ie) {
}
}
// If messengerHome is still null, no outside process has set it and
......
......@@ -29,9 +29,7 @@ import java.util.*;
*
* @author Iain Shigeoka
*/
public class BasicServer
extends BasicModule
implements XMPPServer, BasicServerMBean {
public class BasicServer extends BasicModule implements XMPPServer, BasicServerMBean {
private String name;
private Version version;
......@@ -120,9 +118,9 @@ public class BasicServer
Log.info("--------------------------------------------------------------------");
System.out.println(startupBanner);
params.clear();
params.add(name);
Log.info(LocaleUtils.getLocalizedString("startup.starting", params));
// params.clear();
// params.add(name);
// Log.info(LocaleUtils.getLocalizedString("startup.starting", params));
// Register the server as an MBean.
// MBeanManager.registerMBean(this, ("Server:Name=" + getName()));
......@@ -135,4 +133,4 @@ public class BasicServer
super.stop();
stopDate = new Date();
}
}
}
\ No newline at end of file
......@@ -37,7 +37,7 @@
// Check to see if we're in "setup" mode:
ServiceLookup lookup = ServiceLookupFactory.getLookup();
Container container = (Container)lookup.lookup(Container.class);
if( container.isSetupMode() ) {
if (container.isSetupMode()) {
response.sendRedirect("setup-index.jsp");
return;
}
......@@ -46,7 +46,6 @@
// Since anyone that logged in is an admin, it's redundant to recheck.
boolean isSystemAdmin = true;
// Otherwise, get the xmpp server
XMPPServer xmppServer = (XMPPServer)lookup.lookup(XMPPServer.class);
......
......@@ -10,10 +10,10 @@
org.jivesoftware.messenger.JiveGlobals,
org.jivesoftware.database.EmbeddedConnectionProvider,
org.jivesoftware.database.DbConnectionManager,
java.util.HashMap,
org.jivesoftware.database.ConnectionProvider,
org.jivesoftware.database.ConnectionProvider,
org.jivesoftware.database.DbConnectionManager" %>
org.jivesoftware.database.DbConnectionManager,
java.util.*" %>
<%! // Global vars
......@@ -31,6 +31,15 @@
// handle a mode redirect
Map errors = new HashMap();
if (next) {
// First, update with XMPPSettings
Map xmppSettings = (Map)session.getAttribute("xmppSettings");
Iterator iter = xmppSettings.keySet().iterator();
while(iter.hasNext()){
String name = (String)iter.next();
String value = (String)xmppSettings.get(name);
JiveGlobals.setProperty(name, value);
}
if (STANDARD.equals(mode)) {
response.sendRedirect("setup-datasource-standard.jsp");
return;
......
......@@ -86,16 +86,16 @@
conProvider.setUsername(username);
conProvider.setPassword(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.setXMLProperty("database.defaultProvider.minConnections",
Integer.toString(minConnections));
JiveGlobals.setXMLProperty("database.defaultProvider.maxConnections",
Integer.toString(maxConnections));
JiveGlobals.setXMLProperty("database.defaultProvider.connectionTimeout",
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.setXMLProperty("database.defaultProvider.minConnections",
Integer.toString(minConnections));
JiveGlobals.setXMLProperty("database.defaultProvider.maxConnections",
Integer.toString(maxConnections));
JiveGlobals.setXMLProperty("database.defaultProvider.connectionTimeout",
Double.toString(connectionTimeout));
}
catch (Exception e) {
......@@ -106,16 +106,6 @@
// No errors setting the properties, so test the connection
DbConnectionManager.setConnectionProvider(conProvider);
if (testConnection(errors)) {
// Update with XMPPSettings
Map xmppSettings = (Map)session.getAttribute("xmppSettings");
Iterator iter = xmppSettings.keySet().iterator();
while(iter.hasNext()){
String name = (String)iter.next();
String value = (String)xmppSettings.get(name);
JiveGlobals.setProperty(name, value);
}
// update the sidebar status
session.setAttribute("jive.setup.sidebar.3","done");
session.setAttribute("jive.setup.sidebar.4","in_progress");
......@@ -185,7 +175,7 @@ information about this process please see the database documentation distributed
<% // DB preset data
List presets = new ArrayList();
presets.add(new String[]{"MySQL","org.gjt.mm.mysql.Driver","jdbc:mysql://[host-name]:3306/[database-name]"});
presets.add(new String[]{"MySQL","com.mysql.jdbc.Driver","jdbc:mysql://[host-name]:3306/[database-name]"});
presets.add(new String[]{"Oracle","oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@[host-name]:1521:[SID]"});
presets.add(new String[]{"MSSQL","com.microsoft.jdbc.sqlserver.SQLServerDriver","jdbc:microsoft:sqlserver://[host-name]:1433"});
presets.add(new String[]{"PostgreSQL","org.postgresql.Driver","jdbc:postgresql://[host-name]:5432/[database-name]"});
......
......@@ -10,7 +10,9 @@
org.jivesoftware.messenger.container.Container,
org.jivesoftware.messenger.container.ServiceLookup,
org.jivesoftware.messenger.container.ServiceLookupFactory,
org.jivesoftware.messenger.auth.UnauthorizedException"
org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.messenger.JiveGlobals,
org.jivesoftware.messenger.XMPPBootContainer"
%>
<% boolean showSidebar = false; %>
......@@ -24,7 +26,7 @@
<p>
This installation of <fmt:message key="title" bundle="${lang}" /> is now complete. Please close this window and
restart your server.
Launch the admin using either the launcher or start as a service to enter the admin tool.
Launch the admin using either the launcher or start as a service to enter the admin console.
</p>
......
......@@ -16,8 +16,7 @@
</table><br>
<div class="jive-setup-footer">
&copy; <a href="http://www.jivesoftware.com" target="_blank">Jive Software</a>,
2000-<%= (Calendar.getInstance()).get(Calendar.YEAR) %>
&copy; <a href="http://www.jivesoftware.org" target="_blank">Jive Software</a>, 2004
</div>
</body>
......
......@@ -15,15 +15,10 @@
<% // Get parameters
String domain = ParamUtils.getParameter(request,"domain");
String chatDomain = ParamUtils.getParameter(request,"chatDomain");
String chatService = ParamUtils.getParameter(request,"chatService");
int port = ParamUtils.getIntParameter(request,"port",-1);
int embeddedPort = ParamUtils.getIntParameter(request,"embeddedPort",-1);
int sslPort = ParamUtils.getIntParameter(request,"sslPort",-1);
String storeType = ParamUtils.getParameter(request,"storeType",true);
String keystore = ParamUtils.getParameter(request,"keystore",true);
String keypass = ParamUtils.getParameter(request,"keypass",true);
String truststore = ParamUtils.getParameter(request,"truststore",true);
String trustpass = ParamUtils.getParameter(request,"trustpass",true);
boolean sslEnabled = ParamUtils.getBooleanParameter(request,"sslEnabled");
boolean doContinue = request.getParameter("continue") != null;
......@@ -35,8 +30,8 @@
if (domain == null) {
errors.put("domain","domain");
}
if (chatDomain == null) {
errors.put("chatDomain","chatDomain");
if (chatService == null || chatService.indexOf('.') >= 0) {
errors.put("chatService","chatService");
}
if (port < 0) {
errors.put("port","port");
......@@ -54,7 +49,7 @@
Map xmppSettings = new HashMap();
xmppSettings.put("xmpp.domain",domain);
xmppSettings.put("xmpp.chat.domain",chatDomain);
xmppSettings.put("xmpp.muc.service",chatService);
xmppSettings.put("xmpp.socket.plain.port",Integer.toString(port));
xmppSettings.put("embedded-web.port",Integer.toString(embeddedPort));
xmppSettings.put("xmpp.socket.ssl.active",""+sslEnabled);
......@@ -62,12 +57,6 @@
xmppSettings.put("xmpp.auth.anonymous", "true" );
session.setAttribute("xmppSettings", xmppSettings);
// JiveGlobals.setXMLProperty("xmpp.socket.ssl.storeType",storeType);
// JiveGlobals.setXMLProperty("xmpp.socket.ssl.keystore",keystore);
// JiveGlobals.setXMLProperty("xmpp.socket.ssl.keypass",keypass);
// JiveGlobals.setXMLProperty("xmpp.socket.ssl.truststore",truststore);
// JiveGlobals.setXMLProperty("xmpp.socket.ssl.trustpass",trustpass);
// update the sidebar status
session.setAttribute("jive.setup.sidebar.2","done");
session.setAttribute("jive.setup.sidebar.3","in_progress");
......@@ -81,12 +70,7 @@
// Load the current values:
if (!doContinue) {
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");
chatService = JiveGlobals.getProperty("xmpp.muc.service");
try {
port = Integer.parseInt(JiveGlobals.getProperty("xmpp.socket.plain.port"));
} catch (Exception ignored) {}
......@@ -101,8 +85,8 @@
// If the domain and chat domain are still blank, guess at their values:
if (domain == null) {
domain = InetAddress.getLocalHost().getHostName();
if (domain != null && chatDomain == null) {
chatDomain = "chat." + domain;
if (domain != null && chatService == null) {
chatService = "conference";
}
}
}
......@@ -115,18 +99,10 @@ Server Settings
</p>
<p>
Below are host and port settings for this server. Note, Setup has suggested values for the
domain and chat domain fields based on the network settings for this machine.
Below are host and port settings for this server. Note, the suggested value for the
domain is based on the network settings of this machine.
</p>
<script language="JavaScript" type="text/javascript">
function fillChatDomain(el) {
if (el.chatDomain.value == '' && el.domain.value != '') {
el.chatDomain.value = 'chat.' + el.domain.value;
}
}
</script>
<style type="text/css">
LABEL { font-weight : normal; }
</style>
......@@ -136,11 +112,6 @@ LABEL { font-weight : normal; }
<script langauge="JavaScript" type="text/javascript">
function toggle(form,disabled) {
form.sslPort.disabled = disabled;
// form.storeType.disabled = disabled;
// form.keystore.disabled = disabled;
// form.keypass.disabled = disabled;
// form.truststore.disabled = disabled;
// form.trustpass.disabled = disabled;
}
</script>
......@@ -158,7 +129,6 @@ function toggle(form,disabled) {
</td>
<td width="99%">
<input type="text" size="30" maxlength="150" name="domain"
onblur="fillChatDomain(this.form);"
value="<%= ((domain != null) ? domain : "") %>">
<span class="jive-description">
<br>
......@@ -169,20 +139,20 @@ function toggle(form,disabled) {
<tr valign="top">
<td width="1%" nowrap>
Chat Domain:
<% if (errors.get("chatDomain") != null) { %>
<% if (errors.get("chatService") != null) { %>
<span class="jive-error-text"><br>
Invalid chat domain.
Invalid multi-user chat service name.
</span>
<% } %>
</td>
<td width="99%">
<input type="text" size="30" maxlength="150" name="chatDomain"
value="<%= ((chatDomain != null) ? chatDomain : "") %>">
<input type="text" size="30" maxlength="150" name="chatService"
value="<%= ((chatService != null) ? chatService : "conference") %>">
<span class="jive-description">
<br>
Hostname or IP address of the chat server.
Multi-user chat service name. Default is "conference".
</span>
</td>
</tr>
......@@ -199,7 +169,7 @@ function toggle(form,disabled) {
</td>
<td width="99%">
<input type="text" size="6" maxlength="6" name="port"
value="<%= ((port != -1) ? ""+port : "") %>">
value="<%= ((port != -1) ? ""+port : "5222") %>">
<span class="jive-description">
<br>
Port number this server listens to. Default XMPP port is 5222.
......@@ -208,7 +178,7 @@ function toggle(form,disabled) {
</tr>
<tr valign="top">
<td width="1%" nowrap>
Embedded Web Server Port:
Admin Console Port:
<% if (errors.get("embeddedPort") != null) { %>
<span class="jive-error-text"><br>
......@@ -219,7 +189,7 @@ function toggle(form,disabled) {
</td>
<td width="99%">
<input type="text" size="6" maxlength="6" name="embeddedPort"
value="<%= ((embeddedPort != -1) ? ""+embeddedPort : "") %>">
value="<%= ((embeddedPort != -1) ? ""+embeddedPort : "9090") %>">
<span class="jive-description">
<br>
Port number for the web-based admin console. Default port is 9090.
......@@ -262,73 +232,6 @@ function toggle(form,disabled) {
</span>
</td>
</tr>
<!--
<tr valign="top">
<td width="1%" nowrap>
Server Certificate Store Type:
</td>
<td width="99%">
<input type="text" size="30" maxlength="150" name="storeType"
value="<%= ((storeType != null) ? storeType : "") %>">
<span class="jive-description">
<br>
A code for the type of key store. Default is 'JKS' for Java Key Store (Sun's implmentation).
</span>
</td>
</tr>
<tr valign="top">
<td width="1%" nowrap>
Server Certificate Store:
</td>
<td width="99%">
<input type="text" size="30" maxlength="150" name="keystore"
value="<%= ((keystore != null) ? keystore : "") %>">
<span class="jive-description">
<br>
Filename (relative to meessengerHome directory) of the certificate used for this server.
</span>
</td>
</tr>
<tr valign="top">
<td width="1%" nowrap>
Server Store Password:
</td>
<td width="99%">
<input type="password" size="15" maxlength="50" name="keypass"
value="<%= ((keypass != null) ? keypass : "") %>">
<span class="jive-description">
<br>
Password for the server's certificate.
</span>
</td>
</tr>
<tr valign="top">
<td width="1%" nowrap>
Client Certificate Store:
</td>
<td width="99%">
<input type="text" size="30" maxlength="150" name="truststore"
value="<%= ((truststore != null) ? truststore : "") %>">
<span class="jive-description">
<br>
Filename (relative to messengerHome directory) of the store used for client certificates.
</span>
</td>
</tr>
<tr valign="top">
<td width="1%" nowrap>
Client Store Password:
</td>
<td width="99%">
<input type="password" size="15" maxlength="50" name="trustpass"
value="<%= ((trustpass != null) ? trustpass : "") %>">
<span class="jive-description">
<br>
Password for the client certificate store.
</span>
</td>
</tr>
-->
</table>
<br><br>
......
......@@ -41,7 +41,7 @@
// Error checking
Map messengerHomeErrors = new HashMap();
// Get a handle on the jiveHome directory
// Get a handle on the messengerHome directory
File messengerHomeDir = new File(JiveGlobals.getMessengerHome());
// Validate it:
if (messengerHomeDir == null || !messengerHomeDir.exists()) {
......@@ -105,7 +105,7 @@ below.
<br>
<span class="jive-info">
Appserver: <%= application.getServerInfo() %>,
Supports Servlet 2.2 API and JSP 1.2.
Supports Servlet 2.3 API and JSP 1.2.
</span>
</td>
<td align="center" class="jive-setup-checklist-box"><img src="images/check.gif" width="13" height="13" border="0"></td>
......@@ -118,7 +118,7 @@ below.
</tr>
<tr>
<td class="jive-setup-category">
jive-xmpp.jar
messenger.jar
<br>
<span class="jive-info">
<fmt:message key="title" bundle="${lang}" /> classes.
......@@ -134,7 +134,7 @@ below.
</tr>
<tr>
<td class="jive-setup-category">
jiveHome Directory
messengerHome Directory
<br>
<span class="jive-info">
<% boolean messengerHomeOK = true;
......@@ -150,7 +150,7 @@ below.
<% if (messengerHomeErrors.get("exists") != null) { %>
Unable to locate valid messengerHome directory. Please refer to the installation
documentation for the correct way to set the jiveHome directory.
documentation for the correct way to set the messengerHome directory.
<% } else if (messengerHomeErrors.get("read") != 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