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