Commit 3021021f authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Refactoring work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6714 b35dd754-fafc-0310-a699-88a17e54d16e
parent 82bbbc3a
...@@ -18,7 +18,6 @@ import org.jivesoftware.util.JiveGlobals; ...@@ -18,7 +18,6 @@ import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.wildfire.IQHandlerInfo; import org.jivesoftware.wildfire.IQHandlerInfo;
import org.jivesoftware.wildfire.SessionManager; import org.jivesoftware.wildfire.SessionManager;
import org.jivesoftware.wildfire.XMPPServer; import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.forms.spi.XDataFormImpl; import org.jivesoftware.wildfire.forms.spi.XDataFormImpl;
import org.jivesoftware.wildfire.handler.IQHandler; import org.jivesoftware.wildfire.handler.IQHandler;
import org.jivesoftware.wildfire.user.UserManager; import org.jivesoftware.wildfire.user.UserManager;
...@@ -84,7 +83,7 @@ public class IQDiscoInfoHandler extends IQHandler { ...@@ -84,7 +83,7 @@ public class IQDiscoInfoHandler extends IQHandler {
return info; return info;
} }
public IQ handleIQ(IQ packet) throws UnauthorizedException { public IQ handleIQ(IQ packet) {
// Create a copy of the sent pack that will be used as the reply // Create a copy of the sent pack that will be used as the reply
// we only need to add the requested info to the reply if any otherwise add // we only need to add the requested info to the reply if any otherwise add
// a not found error // a not found error
......
...@@ -17,7 +17,6 @@ import org.dom4j.QName; ...@@ -17,7 +17,6 @@ import org.dom4j.QName;
import org.jivesoftware.wildfire.IQHandlerInfo; import org.jivesoftware.wildfire.IQHandlerInfo;
import org.jivesoftware.wildfire.SessionManager; import org.jivesoftware.wildfire.SessionManager;
import org.jivesoftware.wildfire.XMPPServer; import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.handler.IQHandler; import org.jivesoftware.wildfire.handler.IQHandler;
import org.jivesoftware.wildfire.roster.RosterItem; import org.jivesoftware.wildfire.roster.RosterItem;
import org.jivesoftware.wildfire.session.Session; import org.jivesoftware.wildfire.session.Session;
...@@ -71,9 +70,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv ...@@ -71,9 +70,7 @@ public class IQDiscoItemsHandler extends IQHandler implements ServerFeaturesProv
return info; return info;
} }
public IQ handleIQ(IQ packet) throws UnauthorizedException { public IQ handleIQ(IQ packet) {
// TODO Let configure an authorization policy (ACL?). Currently anyone can discover items.
// Create a copy of the sent pack that will be used as the reply // Create a copy of the sent pack that will be used as the reply
// we only need to add the requested items to the reply if any otherwise add // we only need to add the requested items to the reply if any otherwise add
// a not found error // a not found error
......
...@@ -18,10 +18,13 @@ import org.jivesoftware.util.Log; ...@@ -18,10 +18,13 @@ import org.jivesoftware.util.Log;
import org.jivesoftware.util.PropertyEventDispatcher; import org.jivesoftware.util.PropertyEventDispatcher;
import org.jivesoftware.util.PropertyEventListener; import org.jivesoftware.util.PropertyEventListener;
import org.jivesoftware.wildfire.*; import org.jivesoftware.wildfire.*;
import org.jivesoftware.wildfire.filetransfer.FileTransferManager;
import org.jivesoftware.wildfire.auth.UnauthorizedException; import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.container.BasicModule; import org.jivesoftware.wildfire.container.BasicModule;
import org.jivesoftware.wildfire.disco.*; import org.jivesoftware.wildfire.disco.DiscoInfoProvider;
import org.jivesoftware.wildfire.disco.DiscoItemsProvider;
import org.jivesoftware.wildfire.disco.DiscoServerItem;
import org.jivesoftware.wildfire.disco.ServerItemsProvider;
import org.jivesoftware.wildfire.filetransfer.FileTransferManager;
import org.jivesoftware.wildfire.forms.spi.XDataFormImpl; import org.jivesoftware.wildfire.forms.spi.XDataFormImpl;
import org.xmpp.packet.IQ; import org.xmpp.packet.IQ;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
...@@ -95,25 +98,15 @@ public class FileTransferProxy extends BasicModule ...@@ -95,25 +98,15 @@ public class FileTransferProxy extends BasicModule
} }
if ("http://jabber.org/protocol/disco#info".equals(namespace)) { if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try { IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(packet);
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(packet); router.route(reply);
router.route(reply); return true;
return true;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} }
else if ("http://jabber.org/protocol/disco#items".equals(namespace)) { else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try { // a component
// a component IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(packet);
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(packet); router.route(reply);
router.route(reply); return true;
return true;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} }
else if (FileTransferManager.NAMESPACE_BYTESTREAMS.equals(namespace)) { else if (FileTransferManager.NAMESPACE_BYTESTREAMS.equals(namespace)) {
if (packet.getType() == IQ.Type.get) { if (packet.getType() == IQ.Type.get) {
......
...@@ -262,26 +262,16 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha ...@@ -262,26 +262,16 @@ public class MultiUserChatServerImpl extends BasicModule implements MultiUserCha
router.route(reply); router.route(reply);
} }
else if ("http://jabber.org/protocol/disco#info".equals(namespace)) { else if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try { // TODO MUC should have an IQDiscoInfoHandler of its own when MUC becomes
// TODO MUC should have an IQDiscoInfoHandler of its own when MUC becomes // a component
// a component IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq); router.route(reply);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} }
else if ("http://jabber.org/protocol/disco#items".equals(namespace)) { else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try { // TODO MUC should have an IQDiscoItemsHandler of its own when MUC becomes
// TODO MUC should have an IQDiscoItemsHandler of its own when MUC becomes // a component
// a component IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq); router.route(reply);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} }
else { else {
return false; return false;
......
...@@ -21,7 +21,6 @@ import org.jivesoftware.wildfire.PacketRouter; ...@@ -21,7 +21,6 @@ import org.jivesoftware.wildfire.PacketRouter;
import org.jivesoftware.wildfire.RoutableChannelHandler; import org.jivesoftware.wildfire.RoutableChannelHandler;
import org.jivesoftware.wildfire.RoutingTable; import org.jivesoftware.wildfire.RoutingTable;
import org.jivesoftware.wildfire.XMPPServer; import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.component.InternalComponentManager; import org.jivesoftware.wildfire.component.InternalComponentManager;
import org.jivesoftware.wildfire.container.BasicModule; import org.jivesoftware.wildfire.container.BasicModule;
import org.jivesoftware.wildfire.disco.DiscoInfoProvider; import org.jivesoftware.wildfire.disco.DiscoInfoProvider;
...@@ -155,26 +154,16 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di ...@@ -155,26 +154,16 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
namespace = childElement.getNamespaceURI(); namespace = childElement.getNamespaceURI();
} }
if ("http://jabber.org/protocol/disco#info".equals(namespace)) { if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try { // TODO PubSub should have an IQDiscoInfoHandler of its own when PubSub becomes
// TODO PubSub should have an IQDiscoInfoHandler of its own when PubSub becomes // a component
// a component IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
IQ reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq); router.route(reply);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} }
else if ("http://jabber.org/protocol/disco#items".equals(namespace)) { else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try { // TODO PubSub should have an IQDiscoItemsHandler of its own when PubSub becomes
// TODO PubSub should have an IQDiscoItemsHandler of its own when PubSub becomes // a component
// a component IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
IQ reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq); router.route(reply);
router.route(reply);
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} }
else { else {
// Unknown namespace requested so return error to sender // Unknown namespace requested so return error to sender
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
package org.jivesoftware.wildfire.stun; package org.jivesoftware.wildfire.stun;
import de.javawi.jstun.test.demo.StunServer; import de.javawi.jstun.test.demo.StunServer;
import org.bouncycastle.util.Strings;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
...@@ -28,16 +27,12 @@ import org.xmpp.packet.IQ; ...@@ -28,16 +27,12 @@ import org.xmpp.packet.IQ;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import org.xmpp.packet.PacketError; import org.xmpp.packet.PacketError;
import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
import org.apache.mina.transport.socket.nio.SocketAcceptor; import java.net.InetAddress;
import org.apache.mina.common.IoAcceptor; import java.net.NetworkInterface;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory; import java.net.SocketException;
import org.apache.mina.filter.codec.ProtocolCodecFilter; import java.net.UnknownHostException;
import org.apache.mina.filter.LoggingFilter;
import java.net.*;
import java.util.*; import java.util.*;
import java.nio.charset.Charset;
/** /**
* STUN Server and Service Module * STUN Server and Service Module
...@@ -201,24 +196,14 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou ...@@ -201,24 +196,14 @@ public class STUNService extends BasicModule implements ServerItemsProvider, Rou
reply.setChildElement(childElementCopy); reply.setChildElement(childElementCopy);
if ("http://jabber.org/protocol/disco#info".equals(namespace)) { if ("http://jabber.org/protocol/disco#info".equals(namespace)) {
try { reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq);
reply = XMPPServer.getInstance().getIQDiscoInfoHandler().handleIQ(iq); router.route(reply);
router.route(reply); return;
return;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} else if ("http://jabber.org/protocol/disco#items".equals(namespace)) { } else if ("http://jabber.org/protocol/disco#items".equals(namespace)) {
try { // a component
// a component reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq);
reply = XMPPServer.getInstance().getIQDiscoItemsHandler().handleIQ(iq); router.route(reply);
router.route(reply); return;
return;
}
catch (UnauthorizedException e) {
// Do nothing. This error should never happen
}
} else if (NAMESPACE.equals(namespace)) { } else if (NAMESPACE.equals(namespace)) {
Element stun = childElementCopy.addElement("stun"); Element stun = childElementCopy.addElement("stun");
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<%@ page import="org.jivesoftware.wildfire.XMPPServer" %> <%@ page import="org.jivesoftware.wildfire.XMPPServer" %>
<%@ page import="org.jivesoftware.wildfire.mediaproxy.MediaProxyService" %> <%@ page import="org.jivesoftware.wildfire.mediaproxy.MediaProxyService" %>
<%@ page import="org.jivesoftware.wildfire.mediaproxy.MediaProxySession" %> <%@ page import="org.jivesoftware.wildfire.mediaproxy.MediaProxySession" %>
<%@ page import="org.jivesoftware.wildfire.mediaproxy.SmartSession" %> <%@ page import="org.jivesoftware.wildfire.mediaproxy.RelaySession" %>
<%@ page import="java.util.List" %> <%@ page import="java.util.Collection" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<td> <td>
<input type="text" size="5" maxlength="8" <input type="text" size="5" maxlength="8"
name="idleTimeout" name="idleTimeout"
value="<%=(long)mediaProxyService.getIdleTime()/1000%>" value="<%=mediaProxyService.getIdleTime()/1000%>"
align="left"> align="left">
</td> </td>
</tr> </tr>
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
<tbody> <tbody>
<% // Print the list of agents <% // Print the list of agents
List<MediaProxySession> sessions = mediaProxyService.getAgents(); Collection<MediaProxySession> sessions = mediaProxyService.getAgents();
if (sessions.isEmpty()) { if (sessions.isEmpty()) {
%> %>
<tr> <tr>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
<%=(System.currentTimeMillis() - proxySession.getTimestamp()) / 1000%> <%=(System.currentTimeMillis() - proxySession.getTimestamp()) / 1000%>
</td> </td>
<td width="10%"> <td width="10%">
<% if (proxySession instanceof SmartSession) { %> <% if (proxySession instanceof RelaySession) { %>
Smart Session Smart Session
<% } else { %> <% } else { %>
Fixed Session Fixed Session
......
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