Index: C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/XMPPServer.java =================================================================== --- C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/XMPPServer.java (revision 2688) +++ C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/XMPPServer.java (working copy) @@ -53,6 +53,8 @@ import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.security.KeyStore; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -94,6 +96,7 @@ private static XMPPServer instance; private String name; + private String host; private Version version; private Date startDate; private boolean initialized = false; @@ -313,6 +316,12 @@ name = JiveGlobals.getProperty("xmpp.domain", "127.0.0.1").toLowerCase(); + try { + host = InetAddress.getLocalHost().getHostName(); + } catch (UnknownHostException ex) { + Log.warn("Unable to determine local hostname.", ex); + } + version = new Version(3, 4, 2, Version.ReleaseStatus.Release, -1); if ("true".equals(JiveGlobals.getXMLProperty("setup"))) { setupMode = false; @@ -412,7 +421,7 @@ setupMode = false; // Update server info - xmppServerInfo = new XMPPServerInfoImpl(name, version, startDate, getConnectionManager()); + xmppServerInfo = new XMPPServerInfoImpl(name, host, version, startDate, getConnectionManager()); } } @@ -422,7 +431,7 @@ startDate = new Date(); // Store server info - xmppServerInfo = new XMPPServerInfoImpl(name, version, startDate, getConnectionManager()); + xmppServerInfo = new XMPPServerInfoImpl(name, host, version, startDate, getConnectionManager()); // Create PluginManager now (but don't start it) so that modules may use it File pluginDir = new File(openfireHome, "plugins"); Index: C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/spi/XMPPServerInfoImpl.java =================================================================== --- C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/spi/XMPPServerInfoImpl.java (revision 2688) +++ C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/spi/XMPPServerInfoImpl.java (working copy) @@ -11,16 +11,16 @@ package org.jivesoftware.openfire.spi; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; + import org.jivesoftware.openfire.ConnectionManager; import org.jivesoftware.openfire.ServerPort; import org.jivesoftware.openfire.XMPPServerInfo; import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.Version; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; - /** * Implements the server info for a basic server. Optimization opportunities * in reusing this object the data is relatively static. @@ -29,47 +29,67 @@ */ public class XMPPServerInfoImpl implements XMPPServerInfo { - private Date startDate; - private String name; + private long startDate; + private String xmppDomain; + private String hostname; private Version ver; private ConnectionManager connectionManager; /** * Simple constructor * - * @param serverName the server's serverName (e.g. example.org). + * @param xmppDomain the server's XMPP domain name (e.g. example.org). + * @param hostname the server's host name (e.g. server1.example.org). * @param version the server's version number. * @param startDate the server's last start time (can be null indicating * it hasn't been started). * @param connectionManager the object that keeps track of the active ports. */ - public XMPPServerInfoImpl(String serverName, Version version, Date startDate, ConnectionManager connectionManager) { - this.name = serverName; + public XMPPServerInfoImpl(String xmppDomain, String hostname, Version version, Date startDate, ConnectionManager connectionManager) { + this.xmppDomain = xmppDomain; + this.hostname = hostname; this.ver = version; - this.startDate = startDate; + this.startDate = startDate.getTime(); this.connectionManager = connectionManager; - } - + } + public Version getVersion() { return ver; } + @Deprecated public String getName() { - return name; + return getXmppDomain(); } + @Deprecated public void setName(String serverName) { - name = serverName; - if (serverName == null) { + setXmppDomain(serverName); + } + + public String getHostname() + { + return hostname; + } + + public String getXmppDomain() + { + return xmppDomain; + } + + public void setXmppDomain(String domainName) + { + this.xmppDomain = domainName; + if (domainName == null) { JiveGlobals.deleteProperty("xmpp.domain"); } else { - JiveGlobals.setProperty("xmpp.domain", serverName); + JiveGlobals.setProperty("xmpp.domain", domainName); } - } - + } + public Date getLastStarted() { - return startDate; + return new Date(startDate); } public Collection getServerPorts() { Index: C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/XMPPServerInfo.java =================================================================== --- C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/XMPPServerInfo.java (revision 2710) +++ C:/Users/Guus/workspace/Complete Nimbuzz Server Deployment/openfire/jive-source/openfire_3_4_2/src/java/org/jivesoftware/openfire/XMPPServerInfo.java (working copy) @@ -33,21 +33,49 @@ public Version getVersion(); /** - * Obtain the server name (ip address or hostname). + * Obtain the server name (IP address or hostname). * - * @return the server's name as an ip address or host name. + * @return the server's name as an IP address or host name. + * @deprecated replaced by {@link #getXmppDomain()} */ + @Deprecated public String getName(); /** - * Set the server name (ip address or hostname). The server + * Set the server name (IP address or hostname). The server * must be restarted for this change to take effect. * - * @param serverName the server's name as an ip address or host name. + * @param serverName the server's name as an IP address or host name. + * @deprecated replaced by {@link #setXmppDomain(String)} */ + @Deprecated public void setName(String serverName); /** + * Obtain the host name (IP address or hostname) of this server node. + * + * @return the server's host name as an IP address or host name. + */ + public String getHostname(); + + /** + * Obtain the server XMPP domain name. Note that, if unconfigured, the + * returned value will equal the hostname or IP address of the server. + * + * @return the name of the XMPP domain that this server is part of. + */ + public String getXmppDomain(); + + /** + * Set the server XMPP domain name. The server must be + * restarted for this change to take effect. + * + * @param domainName + * the XMPP domain that this server is part of. + */ + public void setXmppDomain(String domainName); + + /** * Obtain the date when the server was last started. * * @return the date the server was started or null if server has not been started.