Commit 55edc080 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Refactoring work. Merged the XMPPServer interface and BasicServer class in a...

Refactoring work. Merged the XMPPServer interface and BasicServer class in a unique class called XMPPServer.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@707 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1d8308b6
...@@ -14,7 +14,6 @@ package org.jivesoftware.admin; ...@@ -14,7 +14,6 @@ package org.jivesoftware.admin;
import org.jivesoftware.util.ClassUtils; import org.jivesoftware.util.ClassUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.spi.BasicServer;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.DocumentFactory; import org.dom4j.DocumentFactory;
...@@ -134,7 +133,7 @@ public class AdminConsole { ...@@ -134,7 +133,7 @@ public class AdminConsole {
} }
else { else {
// Default to the Jive Messenger version if none has been provided via XML. // Default to the Jive Messenger version if none has been provided via XML.
XMPPServer xmppServer = BasicServer.getInstance(); XMPPServer xmppServer = XMPPServer.getInstance();
return xmppServer.getServerInfo().getVersion().getVersionString(); return xmppServer.getServerInfo().getVersion().getVersionString();
} }
} }
......
...@@ -2,7 +2,6 @@ package org.jivesoftware.messenger; ...@@ -2,7 +2,6 @@ package org.jivesoftware.messenger;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.jivesoftware.messenger.spi.BasicServer;
import org.jivesoftware.util.StringUtils; import org.jivesoftware.util.StringUtils;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
...@@ -102,7 +101,7 @@ public class ComponentManager { ...@@ -102,7 +101,7 @@ public class ComponentManager {
*/ */
public void sendPacket(Packet packet) { public void sendPacket(Packet packet) {
PacketRouter router; PacketRouter router;
router = BasicServer.getInstance().getPacketRouter(); router = XMPPServer.getInstance().getPacketRouter();
if (router != null) { if (router != null) {
router.route(packet); router.route(packet);
} }
......
...@@ -15,7 +15,6 @@ import org.jivesoftware.database.SequenceManager; ...@@ -15,7 +15,6 @@ import org.jivesoftware.database.SequenceManager;
import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.util.*; import org.jivesoftware.util.*;
import org.jivesoftware.messenger.container.BasicModule; import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.spi.BasicServer;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.dom4j.DocumentFactory; import org.dom4j.DocumentFactory;
...@@ -51,7 +50,7 @@ public class OfflineMessageStore extends BasicModule { ...@@ -51,7 +50,7 @@ public class OfflineMessageStore extends BasicModule {
* @return the instance of <CODE>OfflineMessageStore</CODE> being used by the XMPPServer. * @return the instance of <CODE>OfflineMessageStore</CODE> being used by the XMPPServer.
*/ */
public static OfflineMessageStore getInstance() { public static OfflineMessageStore getInstance() {
return BasicServer.getInstance().getOfflineMessageStore(); return XMPPServer.getInstance().getOfflineMessageStore();
} }
private SAXReader saxReader = new SAXReader(); private SAXReader saxReader = new SAXReader();
......
...@@ -30,7 +30,6 @@ import org.jivesoftware.messenger.auth.UnauthorizedException; ...@@ -30,7 +30,6 @@ import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.container.BasicModule; import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.spi.BasicStreamIDFactory; import org.jivesoftware.messenger.spi.BasicStreamIDFactory;
import org.jivesoftware.messenger.spi.SessionImpl; import org.jivesoftware.messenger.spi.SessionImpl;
import org.jivesoftware.messenger.spi.BasicServer;
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.messenger.handler.PresenceUpdateHandler; import org.jivesoftware.messenger.handler.PresenceUpdateHandler;
...@@ -69,7 +68,7 @@ public class SessionManager extends BasicModule implements ConnectionCloseListen ...@@ -69,7 +68,7 @@ public class SessionManager extends BasicModule implements ConnectionCloseListen
* @return the instance of <CODE>SessionManagerImpl</CODE> being used by the XMPPServer. * @return the instance of <CODE>SessionManagerImpl</CODE> being used by the XMPPServer.
*/ */
public static SessionManager getInstance() { public static SessionManager getInstance() {
return BasicServer.getInstance().getSessionManager(); return XMPPServer.getInstance().getSessionManager();
} }
public SessionManager() { public SessionManager() {
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
package org.jivesoftware.messenger; package org.jivesoftware.messenger;
import org.jivesoftware.messenger.spi.BasicServer;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
...@@ -28,7 +26,7 @@ public class XMPPBootServlet extends HttpServlet { ...@@ -28,7 +26,7 @@ public class XMPPBootServlet extends HttpServlet {
if (server == null) { if (server == null) {
synchronized (serverLock) { synchronized (serverLock) {
if (server == null) { if (server == null) {
server = new BasicServer(); server = new XMPPServer();
} }
} }
} }
......
...@@ -13,7 +13,6 @@ package org.jivesoftware.messenger.disco; ...@@ -13,7 +13,6 @@ package org.jivesoftware.messenger.disco;
import org.jivesoftware.messenger.forms.spi.XDataFormImpl; import org.jivesoftware.messenger.forms.spi.XDataFormImpl;
import org.jivesoftware.messenger.*; import org.jivesoftware.messenger.*;
import org.jivesoftware.messenger.spi.BasicServer;
import org.jivesoftware.messenger.handler.IQHandler; import org.jivesoftware.messenger.handler.IQHandler;
import org.jivesoftware.messenger.auth.UnauthorizedException; import org.jivesoftware.messenger.auth.UnauthorizedException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -79,7 +78,7 @@ public class IQDiscoInfoHandler extends IQHandler { ...@@ -79,7 +78,7 @@ public class IQDiscoInfoHandler extends IQHandler {
// DiscoInfoProvider responsibility to provide information about the JID's name together // DiscoInfoProvider responsibility to provide information about the JID's name together
// with any possible requested node. // with any possible requested node.
DiscoInfoProvider infoProvider = getProvider(packet.getTo() == null ? DiscoInfoProvider infoProvider = getProvider(packet.getTo() == null ?
BasicServer.getInstance().getServerInfo().getName() : packet.getTo().getDomain()); XMPPServer.getInstance().getServerInfo().getName() : packet.getTo().getDomain());
if (infoProvider != null) { if (infoProvider != null) {
// Get the JID's name // Get the JID's name
String name = packet.getTo() == null ? null : packet.getTo().getNode(); String name = packet.getTo() == null ? null : packet.getTo().getNode();
......
...@@ -20,7 +20,6 @@ import org.dom4j.Element; ...@@ -20,7 +20,6 @@ import org.dom4j.Element;
import org.dom4j.QName; import org.dom4j.QName;
import org.jivesoftware.messenger.IQHandlerInfo; import org.jivesoftware.messenger.IQHandlerInfo;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.spi.BasicServer;
import org.jivesoftware.messenger.handler.IQHandler; import org.jivesoftware.messenger.handler.IQHandler;
import org.jivesoftware.messenger.auth.UnauthorizedException; import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.util.StringUtils; import org.jivesoftware.util.StringUtils;
...@@ -88,7 +87,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -88,7 +87,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
// DiscoItemsProvider responsibility to provide the items associated with the JID's name // DiscoItemsProvider responsibility to provide the items associated with the JID's name
// together with any possible requested node. // together with any possible requested node.
DiscoItemsProvider itemsProvider = getProvider(packet.getTo() == null ? DiscoItemsProvider itemsProvider = getProvider(packet.getTo() == null ?
BasicServer.getInstance().getServerInfo().getName() : packet.getTo().getDomain()); XMPPServer.getInstance().getServerInfo().getName() : packet.getTo().getDomain());
if (itemsProvider != null) { if (itemsProvider != null) {
// Get the JID's name // Get the JID's name
String name = packet.getTo() == null ? null : packet.getTo().getNode(); String name = packet.getTo() == null ? null : packet.getTo().getNode();
...@@ -198,7 +197,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -198,7 +197,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
public void start() throws IllegalStateException { public void start() throws IllegalStateException {
super.start(); super.start();
for (ServerItemsProvider provider : BasicServer.getInstance().getServerItemsProviders()) { for (ServerItemsProvider provider : XMPPServer.getInstance().getServerItemsProviders()) {
addServerItemsProvider(provider); addServerItemsProvider(provider);
} }
} }
......
...@@ -57,7 +57,7 @@ import java.util.Map; ...@@ -57,7 +57,7 @@ import java.util.Map;
* </ul> * </ul>
* The valid types include "subscribe", "subscribed", "unsubscribed", * The valid types include "subscribe", "subscribed", "unsubscribed",
* and "unsubscribe". * and "unsubscribe".
* <li>BasicServer probes - Provides a mechanism for servers to query the presence * <li>XMPPServer probes - Provides a mechanism for servers to query the presence
* status of users on another server. This allows users to immediately * status of users on another server. This allows users to immediately
* know the presence status of users when they come online rather than way * know the presence status of users when they come online rather than way
* for a presence update broadcast from the other server or tracking them * for a presence update broadcast from the other server or tracking them
......
...@@ -57,7 +57,7 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -57,7 +57,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
* </ul> * </ul>
* The valid types include "subscribe", "subscribed", "unsubscribed", * The valid types include "subscribe", "subscribed", "unsubscribed",
* and "unsubscribe". * and "unsubscribe".
* <li>BasicServer probes - Provides a mechanism for servers to query the presence * <li>XMPPServer probes - Provides a mechanism for servers to query the presence
* status of users on another server. This allows users to immediately * status of users on another server. This allows users to immediately
* know the presence status of users when they come online rather than way * know the presence status of users when they come online rather than way
* for a presence update broadcast from the other server or tracking them * for a presence update broadcast from the other server or tracking them
......
...@@ -20,7 +20,6 @@ import org.jivesoftware.messenger.PresenceManager; ...@@ -20,7 +20,6 @@ import org.jivesoftware.messenger.PresenceManager;
import org.jivesoftware.messenger.RoutingTable; import org.jivesoftware.messenger.RoutingTable;
import org.jivesoftware.messenger.SessionManager; import org.jivesoftware.messenger.SessionManager;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.spi.BasicServer;
import org.jivesoftware.messenger.auth.UnauthorizedException; import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.roster.BasicRoster; import org.jivesoftware.messenger.roster.BasicRoster;
import org.jivesoftware.messenger.roster.BasicRosterItem; import org.jivesoftware.messenger.roster.BasicRosterItem;
...@@ -104,7 +103,7 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster { ...@@ -104,7 +103,7 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster {
public void broadcastPresence(Presence packet) { public void broadcastPresence(Presence packet) {
try { try {
if (routingTable == null) { if (routingTable == null) {
routingTable = BasicServer.getInstance().getRoutingTable(); routingTable = XMPPServer.getInstance().getRoutingTable();
} }
if (routingTable == null) { if (routingTable == null) {
return; return;
...@@ -190,7 +189,7 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster { ...@@ -190,7 +189,7 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster {
if (cachedItem.getSubStatus() == RosterItem.SUB_BOTH if (cachedItem.getSubStatus() == RosterItem.SUB_BOTH
|| cachedItem.getSubStatus() == RosterItem.SUB_TO) { || cachedItem.getSubStatus() == RosterItem.SUB_TO) {
if (presenceManager == null) { if (presenceManager == null) {
presenceManager = BasicServer.getInstance().getPresenceManager(); presenceManager = XMPPServer.getInstance().getPresenceManager();
} }
presenceManager.probePresence(username, cachedItem.getJid()); presenceManager.probePresence(username, cachedItem.getJid());
} }
...@@ -214,7 +213,7 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster { ...@@ -214,7 +213,7 @@ public class CachedRosterImpl extends BasicRoster implements CachedRoster {
private void broadcast(Roster roster) throws UnauthorizedException { private void broadcast(Roster roster) throws UnauthorizedException {
if (server == null) { if (server == null) {
server = BasicServer.getInstance(); server = XMPPServer.getInstance();
} }
JID recipient = server.createJID(username, null); JID recipient = server.createJID(username, null);
roster.setTo(recipient); roster.setTo(recipient);
......
...@@ -79,7 +79,7 @@ public class ServerStarter { ...@@ -79,7 +79,7 @@ public class ServerStarter {
Thread.currentThread().setContextClassLoader(loader); Thread.currentThread().setContextClassLoader(loader);
Class containerClass = loader.loadClass( Class containerClass = loader.loadClass(
"org.jivesoftware.messenger.spi.BasicServer"); "org.jivesoftware.messenger.XMPPServer");
containerClass.newInstance(); containerClass.newInstance();
} }
catch (Exception e) { catch (Exception e) {
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
package org.jivesoftware.messenger.user; package org.jivesoftware.messenger.user;
import org.jivesoftware.messenger.spi.BasicServer;
import org.jivesoftware.messenger.roster.CachedRoster; import org.jivesoftware.messenger.roster.CachedRoster;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.Cacheable; import org.jivesoftware.util.Cacheable;
import org.jivesoftware.util.CacheSizes; import org.jivesoftware.util.CacheSizes;
...@@ -237,7 +237,7 @@ public class User implements Cacheable { ...@@ -237,7 +237,7 @@ public class User implements Cacheable {
*/ */
public CachedRoster getRoster() { public CachedRoster getRoster() {
try { try {
return BasicServer.getInstance().getRosterManager().getRoster(username); return XMPPServer.getInstance().getRosterManager().getRoster(username);
} }
catch (UserNotFoundException unfe) { catch (UserNotFoundException unfe) {
Log.error(unfe); Log.error(unfe);
......
...@@ -21,8 +21,6 @@ import org.jivesoftware.messenger.PrivateStorage; ...@@ -21,8 +21,6 @@ import org.jivesoftware.messenger.PrivateStorage;
import org.jivesoftware.messenger.PresenceManager; import org.jivesoftware.messenger.PresenceManager;
import org.jivesoftware.messenger.SessionManager; import org.jivesoftware.messenger.SessionManager;
import org.jivesoftware.messenger.XMPPServerInfo; import org.jivesoftware.messenger.XMPPServerInfo;
import org.jivesoftware.messenger.roster.RosterManager;
import org.jivesoftware.messenger.spi.BasicServer;
import org.jivesoftware.messenger.group.GroupManager; import org.jivesoftware.messenger.group.GroupManager;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -61,7 +59,7 @@ public class WebManager extends WebBean { ...@@ -61,7 +59,7 @@ public class WebManager extends WebBean {
* Returns the XMPP server object -- can get many config items from here. * Returns the XMPP server object -- can get many config items from here.
*/ */
public XMPPServer getXMPPServer() { public XMPPServer getXMPPServer() {
final XMPPServer xmppServer = BasicServer.getInstance(); final XMPPServer xmppServer = XMPPServer.getInstance();
if (xmppServer == null) { if (xmppServer == null) {
// Show that the server is down // Show that the server is down
showServerDown(); showServerDown();
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
<%@ page import="org.jivesoftware.messenger.auth.AuthToken, <%@ page import="org.jivesoftware.messenger.auth.AuthToken,
org.jivesoftware.util.ClassUtils, org.jivesoftware.util.ClassUtils,
org.jivesoftware.messenger.XMPPServer, org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.user.*, org.jivesoftware.messenger.user.*"
org.jivesoftware.messenger.spi.BasicServer"
%> %>
<% // Security check <% // Security check
...@@ -38,7 +37,7 @@ ...@@ -38,7 +37,7 @@
} }
// Check to see if we're in "setup" mode: // Check to see if we're in "setup" mode:
if (BasicServer.getInstance().isSetupMode()) { if (XMPPServer.getInstance().isSetupMode()) {
response.sendRedirect("setup-index.jsp"); response.sendRedirect("setup-index.jsp");
return; return;
} }
...@@ -48,7 +47,7 @@ ...@@ -48,7 +47,7 @@
boolean isSystemAdmin = true; boolean isSystemAdmin = true;
// Otherwise, get the xmpp server // Otherwise, get the xmpp server
XMPPServer xmppServer = BasicServer.getInstance(); XMPPServer xmppServer = XMPPServer.getInstance();
// The user object of the logged-in user // The user object of the logged-in user
UserManager userManager = xmppServer.getUserManager(); UserManager userManager = xmppServer.getUserManager();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
java.text.DateFormat, java.text.DateFormat,
org.jivesoftware.messenger.XMPPServer, org.jivesoftware.messenger.XMPPServer,
org.jivesoftware.messenger.container.*, org.jivesoftware.messenger.container.*,
org.jivesoftware.messenger.spi.BasicServer,
org.jivesoftware.messenger.auth.UnauthorizedException, org.jivesoftware.messenger.auth.UnauthorizedException,
org.jivesoftware.admin.AdminPageBean" org.jivesoftware.admin.AdminPageBean"
%> %>
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
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.messenger.JiveGlobals,
org.jivesoftware.messenger.auth.DefaultAuthProvider, org.jivesoftware.messenger.auth.DefaultAuthProvider" %>
org.jivesoftware.messenger.spi.BasicServer" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
......
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