Commit a26c4225 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Refactoring wortk. JM-924

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6544 b35dd754-fafc-0310-a699-88a17e54d16e
parent 61224df9
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* $Revision: 3125 $ * $Revision: 3125 $
* $Date: 2005-11-30 15:14:14 -0300 (Wed, 30 Nov 2005) $ * $Date: 2005-11-30 15:14:14 -0300 (Wed, 30 Nov 2005) $
* *
* Copyright (C) 2004 Jive Software. All rights reserved. * Copyright (C) 2007 Jive Software. All rights reserved.
* *
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
...@@ -20,6 +20,8 @@ import org.jivesoftware.wildfire.container.BasicModule; ...@@ -20,6 +20,8 @@ import org.jivesoftware.wildfire.container.BasicModule;
import org.jivesoftware.wildfire.roster.Roster; import org.jivesoftware.wildfire.roster.Roster;
import org.jivesoftware.wildfire.roster.RosterItem; import org.jivesoftware.wildfire.roster.RosterItem;
import org.jivesoftware.wildfire.roster.RosterManager; import org.jivesoftware.wildfire.roster.RosterManager;
import org.jivesoftware.wildfire.session.ClientSession;
import org.jivesoftware.wildfire.session.Session;
import org.jivesoftware.wildfire.user.UserManager; import org.jivesoftware.wildfire.user.UserManager;
import org.jivesoftware.wildfire.user.UserNotFoundException; import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.xmpp.packet.*; import org.xmpp.packet.*;
...@@ -82,10 +84,12 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -82,10 +84,12 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
directedPresences = new ConcurrentHashMap<String, WeakHashMap<ChannelHandler, Set<String>>>(); directedPresences = new ConcurrentHashMap<String, WeakHashMap<ChannelHandler, Set<String>>>();
} }
public void process(Packet xmppPacket) throws UnauthorizedException, PacketException { public void process(Packet packet) throws UnauthorizedException, PacketException {
Presence presence = (Presence)xmppPacket; process((Presence) packet, sessionManager.getSession(packet.getFrom()));
}
public void process(Presence presence, ClientSession session) throws UnauthorizedException, PacketException {
try { try {
ClientSession session = sessionManager.getSession(presence.getFrom());
Presence.Type type = presence.getType(); Presence.Type type = presence.getType();
// Available // Available
if (type == null) { if (type == null) {
...@@ -108,11 +112,6 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -108,11 +112,6 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
else if (Presence.Type.unavailable == type) { else if (Presence.Type.unavailable == type) {
broadcastUpdate(presence.createCopy()); broadcastUpdate(presence.createCopy());
broadcastUnavailableForDirectedPresences(presence); broadcastUnavailableForDirectedPresences(presence);
if (session == null) {
// Recovery logic. Check if a session can be found in the routing table.
session = (ClientSession) XMPPServer.getInstance().getRoutingTable()
.getRoute(presence.getFrom());
}
if (session != null) { if (session != null) {
session.setPresence(presence); session.setPresence(presence);
} }
...@@ -138,8 +137,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler ...@@ -138,8 +137,7 @@ public class PresenceUpdateHandler extends BasicModule implements ChannelHandler
} }
catch (Exception e) { catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error") + ". Triggered by packet: " + Log.error(LocaleUtils.getLocalizedString("admin.error") + ". Triggered by packet: " + presence, e);
xmppPacket, e);
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* $Revision: $ * $Revision: $
* $Date: $ * $Date: $
* *
* Copyright (C) 2006 Jive Software. All rights reserved. * Copyright (C) 2007 Jive Software. All rights reserved.
* *
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
...@@ -15,19 +15,21 @@ import org.dom4j.DocumentHelper; ...@@ -15,19 +15,21 @@ import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.QName; import org.dom4j.QName;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.ClientSession;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.SessionPacketRouter; import org.jivesoftware.wildfire.SessionPacketRouter;
import org.xmpp.packet.*; import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.session.ClientSession;
import org.jivesoftware.wildfire.session.ConnectionMultiplexerSession;
import org.xmpp.packet.IQ;
import org.xmpp.packet.Message;
import org.xmpp.packet.Packet;
import org.xmpp.packet.PacketError;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;
/** /**
* IQ packets sent from Connection Managers themselves to the server will be handled by * IQ packets sent from Connection Managers themselves to the server will be handled by
* instances of this class. Each instance of * instances of this class.<p>
* {@link org.jivesoftware.wildfire.net.ConnectionMultiplexerSocketReader} will have an instance
* of this class so that IQ packets can be routed to this handler.<p>
* <p/> * <p/>
* This class will interact with {@link ConnectionMultiplexerManager} to create, close or * This class will interact with {@link ConnectionMultiplexerManager} to create, close or
* get client sessions. * get client sessions.
...@@ -157,6 +159,8 @@ public class MultiplexerPacketHandler { ...@@ -157,6 +159,8 @@ public class MultiplexerPacketHandler {
} }
SessionPacketRouter router = new SessionPacketRouter(session); SessionPacketRouter router = new SessionPacketRouter(session);
// Connection Manager already validate JIDs so just skip this expensive operation
router.setSkipJIDValidation(true);
try { try {
router.route(route.getChildElement()); router.route(route.getChildElement());
} }
...@@ -228,7 +232,7 @@ public class MultiplexerPacketHandler { ...@@ -228,7 +232,7 @@ public class MultiplexerPacketHandler {
ConnectionMultiplexerSession session = ConnectionMultiplexerSession session =
multiplexerManager.getMultiplexerSession(connectionManagerDomain); multiplexerManager.getMultiplexerSession(connectionManagerDomain);
if (session != null) { if (session != null) {
session.deliver(reply); session.process(reply);
} }
else { else {
Log.warn("No multiplexer session found. Packet not delivered: " + reply.toXML()); Log.warn("No multiplexer session found. Packet not delivered: " + reply.toXML());
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* $Revision: 3187 $ * $Revision: 3187 $
* $Date: 2005-12-11 13:34:34 -0300 (Sun, 11 Dec 2005) $ * $Date: 2005-12-11 13:34:34 -0300 (Sun, 11 Dec 2005) $
* *
* Copyright (C) 2004 Jive Software. All rights reserved. * Copyright (C) 2007 Jive Software. All rights reserved.
* *
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
...@@ -16,11 +16,13 @@ import com.jcraft.jzlib.ZOutputStream; ...@@ -16,11 +16,13 @@ import com.jcraft.jzlib.ZOutputStream;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.*; import org.jivesoftware.wildfire.Connection;
import org.jivesoftware.wildfire.ConnectionCloseListener;
import org.jivesoftware.wildfire.PacketDeliverer;
import org.jivesoftware.wildfire.PacketException;
import org.jivesoftware.wildfire.auth.UnauthorizedException; import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.interceptor.InterceptorManager; import org.jivesoftware.wildfire.session.IncomingServerSession;
import org.jivesoftware.wildfire.interceptor.PacketRejectedException; import org.jivesoftware.wildfire.session.Session;
import org.jivesoftware.wildfire.server.IncomingServerSession;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
...@@ -113,7 +115,7 @@ public class SocketConnection implements Connection { ...@@ -113,7 +115,7 @@ public class SocketConnection implements Connection {
* @param backupDeliverer the packet deliverer this connection will use when socket is closed. * @param backupDeliverer the packet deliverer this connection will use when socket is closed.
* @param socket the socket to represent. * @param socket the socket to represent.
* @param isSecure true if this is a secure connection. * @param isSecure true if this is a secure connection.
* @throws NullPointerException if the socket is null. * @throws java.io.IOException if there was a socket error while sending the packet.
*/ */
public SocketConnection(PacketDeliverer backupDeliverer, Socket socket, boolean isSecure) public SocketConnection(PacketDeliverer backupDeliverer, Socket socket, boolean isSecure)
throws IOException { throws IOException {
...@@ -149,17 +151,6 @@ public class SocketConnection implements Connection { ...@@ -149,17 +151,6 @@ public class SocketConnection implements Connection {
return tlsStreamHandler; return tlsStreamHandler;
} }
/**
* Secures the plain connection by negotiating TLS with the client. When connecting
* to a remote server then <tt>clientMode</tt> will be <code>true</code> and
* <tt>remoteServer</tt> is the server name of the remote server. Otherwise <tt>clientMode</tt>
* will be <code>false</code> and <tt>remoteServer</tt> null.
*
* @param clientMode boolean indicating if this entity is a client or a server.
* @param remoteServer server name of the remote server we are connecting to or <tt>null</tt>
* when not in client mode.
* @throws IOException if an error occured while securing the connection.
*/
public void startTLS(boolean clientMode, String remoteServer) throws IOException { public void startTLS(boolean clientMode, String remoteServer) throws IOException {
if (!secure) { if (!secure) {
secure = true; secure = true;
...@@ -177,16 +168,10 @@ public class SocketConnection implements Connection { ...@@ -177,16 +168,10 @@ public class SocketConnection implements Connection {
} }
} }
/** public void startCompression() {
* Start using compression for this connection. Compression will only be available after TLS
* has been negotiated. This means that a connection can never be using compression before
* TLS. However, it is possible to use compression without TLS.
*
* @throws IOException if an error occured while starting compression.
*/
public void startCompression() throws IOException {
compressed = true; compressed = true;
try {
if (tlsStreamHandler == null) { if (tlsStreamHandler == null) {
ZOutputStream out = new ZOutputStream( ZOutputStream out = new ZOutputStream(
ServerTrafficCounter.wrapOutputStream(socket.getOutputStream()), ServerTrafficCounter.wrapOutputStream(socket.getOutputStream()),
...@@ -201,6 +186,11 @@ public class SocketConnection implements Connection { ...@@ -201,6 +186,11 @@ public class SocketConnection implements Connection {
writer = new BufferedWriter(new OutputStreamWriter(out, CHARSET)); writer = new BufferedWriter(new OutputStreamWriter(out, CHARSET));
xmlSerializer = new XMLSocketWriter(writer, this); xmlSerializer = new XMLSocketWriter(writer, this);
} }
} catch (IOException e) {
// TODO Would be nice to still be able to throw the exception and not catch it here
Log.error("Error while starting compression", e);
compressed = false;
}
} }
public boolean validate() { public boolean validate() {
...@@ -234,19 +224,17 @@ public class SocketConnection implements Connection { ...@@ -234,19 +224,17 @@ public class SocketConnection implements Connection {
session = owner; session = owner;
} }
public Object registerCloseListener(ConnectionCloseListener listener, Object handbackMessage) { public void registerCloseListener(ConnectionCloseListener listener, Object handbackMessage) {
Object status = null;
if (isClosed()) { if (isClosed()) {
listener.onConnectionClose(handbackMessage); listener.onConnectionClose(handbackMessage);
} }
else { else {
status = listeners.put(listener, handbackMessage); listeners.put(listener, handbackMessage);
} }
return status;
} }
public Object removeCloseListener(ConnectionCloseListener listener) { public void removeCloseListener(ConnectionCloseListener listener) {
return listeners.remove(listener); listeners.remove(listener);
} }
public InetAddress getInetAddress() { public InetAddress getInetAddress() {
...@@ -399,13 +387,6 @@ public class SocketConnection implements Connection { ...@@ -399,13 +387,6 @@ public class SocketConnection implements Connection {
return null; return null;
} }
/**
* Returns the packet deliverer to use when delivering a packet over the socket fails. The
* packet deliverer will retry to send the packet using some other connection, will store
* the packet offline for later retrieval or will just drop it.
*
* @return the packet deliverer to use when delivering a packet over the socket fails.
*/
public PacketDeliverer getPacketDeliverer() { public PacketDeliverer getPacketDeliverer() {
return backupDeliverer; return backupDeliverer;
} }
...@@ -553,9 +534,6 @@ public class SocketConnection implements Connection { ...@@ -553,9 +534,6 @@ public class SocketConnection implements Connection {
backupDeliverer.deliver(packet); backupDeliverer.deliver(packet);
} }
else { else {
try {
// Invoke the interceptors before we send the packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, false, false);
boolean errorDelivering = false; boolean errorDelivering = false;
boolean allowedToWrite = false; boolean allowedToWrite = false;
try { try {
...@@ -583,15 +561,9 @@ public class SocketConnection implements Connection { ...@@ -583,15 +561,9 @@ public class SocketConnection implements Connection {
backupDeliverer.deliver(packet); backupDeliverer.deliver(packet);
} }
else { else {
// Invoke the interceptors after we have sent the packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, false, true);
session.incrementServerPacketCount(); session.incrementServerPacketCount();
} }
} }
catch (PacketRejectedException e) {
// An interceptor rejected the packet so do nothing
}
}
} }
public void deliverRawText(String text) { public void deliverRawText(String text) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* $Revision: 3137 $ * $Revision: 3137 $
* $Date: 2005-12-01 02:11:05 -0300 (Thu, 01 Dec 2005) $ * $Date: 2005-12-01 02:11:05 -0300 (Thu, 01 Dec 2005) $
* *
* Copyright (C) 2004 Jive Software. All rights reserved. * Copyright (C) 2007 Jive Software. All rights reserved.
* *
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
...@@ -11,10 +11,12 @@ ...@@ -11,10 +11,12 @@
package org.jivesoftware.wildfire.net; package org.jivesoftware.wildfire.net;
import org.jivesoftware.wildfire.*;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.*;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.session.ClientSession;
import org.jivesoftware.wildfire.session.Session;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
...@@ -61,9 +63,9 @@ public class SocketPacketWriteHandler implements ChannelHandler { ...@@ -61,9 +63,9 @@ public class SocketPacketWriteHandler implements ChannelHandler {
// The target domain belongs to the local server // The target domain belongs to the local server
if (recipient == null || (recipient.getNode() == null && recipient.getResource() == null)) { if (recipient == null || (recipient.getNode() == null && recipient.getResource() == null)) {
// no TO was found so send back the packet to the sender // no TO was found so send back the packet to the sender
Session senderSession = sessionManager.getSession(packet.getFrom()); ClientSession senderSession = sessionManager.getSession(packet.getFrom());
if (senderSession != null && !senderSession.getConnection().isClosed()) { if (senderSession != null) {
senderSession.getConnection().deliver(packet); senderSession.process(packet);
} }
else { else {
// The sender is no longer available so drop the packet // The sender is no longer available so drop the packet
...@@ -77,7 +79,7 @@ public class SocketPacketWriteHandler implements ChannelHandler { ...@@ -77,7 +79,7 @@ public class SocketPacketWriteHandler implements ChannelHandler {
} }
else { else {
try { try {
session.getConnection().deliver(packet); session.process(packet);
} }
catch (Exception e) { catch (Exception e) {
// do nothing // do nothing
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* $Revision: 3187 $ * $Revision: 3187 $
* $Date: 2005-12-11 13:34:34 -0300 (Sun, 11 Dec 2005) $ * $Date: 2005-12-11 13:34:34 -0300 (Sun, 11 Dec 2005) $
* *
* Copyright (C) 2004 Jive Software. All rights reserved. * Copyright (C) 2007 Jive Software. All rights reserved.
* *
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
...@@ -16,11 +16,13 @@ import org.dom4j.io.XMPPPacketReader; ...@@ -16,11 +16,13 @@ import org.dom4j.io.XMPPPacketReader;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.util.StringUtils; import org.jivesoftware.util.StringUtils;
import org.jivesoftware.wildfire.*; import org.jivesoftware.wildfire.Connection;
import org.jivesoftware.wildfire.PacketRouter;
import org.jivesoftware.wildfire.RoutableChannelHandler;
import org.jivesoftware.wildfire.RoutingTable;
import org.jivesoftware.wildfire.auth.UnauthorizedException; import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.interceptor.InterceptorManager;
import org.jivesoftware.wildfire.interceptor.PacketRejectedException;
import org.jivesoftware.wildfire.server.OutgoingSessionPromise; import org.jivesoftware.wildfire.server.OutgoingSessionPromise;
import org.jivesoftware.wildfire.session.Session;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory; import org.xmlpull.v1.XmlPullParserFactory;
...@@ -107,13 +109,8 @@ public abstract class SocketReader implements Runnable { ...@@ -107,13 +109,8 @@ public abstract class SocketReader implements Runnable {
reader.setXPPFactory(factory); reader.setXPPFactory(factory);
// Set the blocking reading mode to use // Set the blocking reading mode to use
if (useBlockingMode) {
readingMode = new BlockingReadingMode(socket, this); readingMode = new BlockingReadingMode(socket, this);
} }
else {
readingMode = new NonBlockingReadingMode(socket, this);
}
}
/** /**
* A dedicated thread loop for reading the stream and sending incoming * A dedicated thread loop for reading the stream and sending incoming
...@@ -243,36 +240,9 @@ public abstract class SocketReader implements Runnable { ...@@ -243,36 +240,9 @@ public abstract class SocketReader implements Runnable {
closeNeverSecuredConnection(); closeNeverSecuredConnection();
return; return;
} }
try {
// Invoke the interceptors before we process the read packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, true,
false);
router.route(packet); router.route(packet);
// Invoke the interceptors after we have processed the read packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, true,
true);
session.incrementClientPacketCount(); session.incrementClientPacketCount();
} }
catch (PacketRejectedException e) {
// An interceptor rejected this packet so answer a not_allowed error
IQ reply = new IQ();
reply.setChildElement(packet.getChildElement().createCopy());
reply.setID(packet.getID());
reply.setTo(session.getAddress());
reply.setFrom(packet.getTo());
reply.setError(PacketError.Condition.not_allowed);
session.process(reply);
// Check if a message notifying the rejection should be sent
if (e.getRejectionMessage() != null && e.getRejectionMessage().trim().length() > 0) {
// A message for the rejection will be sent to the sender of the rejected packet
Message notification = new Message();
notification.setTo(session.getAddress());
notification.setFrom(packet.getTo());
notification.setBody(e.getRejectionMessage());
session.process(notification);
}
}
}
/** /**
* Process the received Presence packet. Registered * Process the received Presence packet. Registered
...@@ -292,35 +262,9 @@ public abstract class SocketReader implements Runnable { ...@@ -292,35 +262,9 @@ public abstract class SocketReader implements Runnable {
closeNeverSecuredConnection(); closeNeverSecuredConnection();
return; return;
} }
try {
// Invoke the interceptors before we process the read packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, true,
false);
router.route(packet); router.route(packet);
// Invoke the interceptors after we have processed the read packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, true,
true);
session.incrementClientPacketCount(); session.incrementClientPacketCount();
} }
catch (PacketRejectedException e) {
// An interceptor rejected this packet so answer a not_allowed error
Presence reply = new Presence();
reply.setID(packet.getID());
reply.setTo(session.getAddress());
reply.setFrom(packet.getTo());
reply.setError(PacketError.Condition.not_allowed);
session.process(reply);
// Check if a message notifying the rejection should be sent
if (e.getRejectionMessage() != null && e.getRejectionMessage().trim().length() > 0) {
// A message for the rejection will be sent to the sender of the rejected packet
Message notification = new Message();
notification.setTo(session.getAddress());
notification.setFrom(packet.getTo());
notification.setBody(e.getRejectionMessage());
session.process(notification);
}
}
}
/** /**
* Process the received Message packet. Registered * Process the received Message packet. Registered
...@@ -340,31 +284,9 @@ public abstract class SocketReader implements Runnable { ...@@ -340,31 +284,9 @@ public abstract class SocketReader implements Runnable {
closeNeverSecuredConnection(); closeNeverSecuredConnection();
return; return;
} }
try {
// Invoke the interceptors before we process the read packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, true,
false);
router.route(packet); router.route(packet);
// Invoke the interceptors after we have processed the read packet
InterceptorManager.getInstance().invokeInterceptors(packet, session, true,
true);
session.incrementClientPacketCount(); session.incrementClientPacketCount();
} }
catch (PacketRejectedException e) {
// An interceptor rejected this packet
if (e.getRejectionMessage() != null && e.getRejectionMessage().trim().length() > 0) {
// A message for the rejection will be sent to the sender of the rejected packet
Message reply = new Message();
reply.setID(packet.getID());
reply.setTo(session.getAddress());
reply.setFrom(packet.getTo());
reply.setType(packet.getType());
reply.setThread(packet.getThread());
reply.setBody(e.getRejectionMessage());
session.process(reply);
}
}
}
/** /**
* Returns true if a received packet of an unkown type (i.e. not a Message, Presence * Returns true if a received packet of an unkown type (i.e. not a Message, Presence
...@@ -538,7 +460,7 @@ public abstract class SocketReader implements Runnable { ...@@ -538,7 +460,7 @@ public abstract class SocketReader implements Runnable {
} }
/** /**
* Creates the appropriate {@link Session} subclass based on the specified namespace. * Creates the appropriate {@link org.jivesoftware.wildfire.session.Session} subclass based on the specified namespace.
* *
* @param namespace the namespace sent in the stream element. eg. jabber:client. * @param namespace the namespace sent in the stream element. eg. jabber:client.
* @return the created session or null. * @return the created session or null.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* $Revision: $ * $Revision: $
* $Date: $ * $Date: $
* *
* Copyright (C) 2006 Jive Software. All rights reserved. * Copyright (C) 2007 Jive Software. All rights reserved.
* *
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
...@@ -15,7 +15,7 @@ import org.dom4j.DocumentException; ...@@ -15,7 +15,7 @@ import org.dom4j.DocumentException;
import org.dom4j.Element; import org.dom4j.Element;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.Connection; import org.jivesoftware.wildfire.Connection;
import org.jivesoftware.wildfire.Session; import org.jivesoftware.wildfire.session.Session;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.xmpp.packet.StreamError; import org.xmpp.packet.StreamError;
...@@ -23,7 +23,7 @@ import java.io.IOException; ...@@ -23,7 +23,7 @@ import java.io.IOException;
import java.net.Socket; import java.net.Socket;
/** /**
* Abstract class for {@link BlockingReadingMode} and {@link NonBlockingReadingMode}. * Abstract class for {@link BlockingReadingMode}.
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* $Revision: $ * $Revision: $
* $Date: $ * $Date: $
* *
* Copyright (C) 2006 Jive Software. All rights reserved. * Copyright (C) 2007 Jive Software. All rights reserved.
* *
* This software is published under the terms of the GNU Public License (GPL), * This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution. * a copy of which is included in this distribution.
...@@ -15,7 +15,8 @@ import org.jivesoftware.util.LocaleUtils; ...@@ -15,7 +15,8 @@ import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.Connection; import org.jivesoftware.wildfire.Connection;
import org.jivesoftware.wildfire.ConnectionCloseListener; import org.jivesoftware.wildfire.ConnectionCloseListener;
import org.jivesoftware.wildfire.Session; import org.jivesoftware.wildfire.PacketDeliverer;
import org.jivesoftware.wildfire.session.Session;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -81,6 +82,39 @@ public abstract class VirtualConnection implements Connection { ...@@ -81,6 +82,39 @@ public abstract class VirtualConnection implements Connection {
return false; return false;
} }
public void setFlashClient(boolean flashClient) {
//Ignore
}
public void setXMPPVersion(int majorVersion, int minorVersion) {
//Ignore
}
public void setLanaguage(String language) {
//Ignore
}
public void setCompressionPolicy(CompressionPolicy compressionPolicy) {
//Ignore
}
public void setTlsPolicy(TLSPolicy tlsPolicy) {
//Ignore
}
public PacketDeliverer getPacketDeliverer() {
//Ignore
return null;
}
public void startTLS(boolean clientMode, String remoteServer) throws Exception {
//Ignore
}
public void startCompression() {
//Ignore
}
public boolean isSecure() { public boolean isSecure() {
// Return false since TLS is not used for virtual connections // Return false since TLS is not used for virtual connections
return false; return false;
...@@ -122,19 +156,17 @@ public abstract class VirtualConnection implements Connection { ...@@ -122,19 +156,17 @@ public abstract class VirtualConnection implements Connection {
} }
} }
public Object registerCloseListener(ConnectionCloseListener listener, Object handbackMessage) { public void registerCloseListener(ConnectionCloseListener listener, Object handbackMessage) {
Object status = null;
if (isClosed()) { if (isClosed()) {
listener.onConnectionClose(handbackMessage); listener.onConnectionClose(handbackMessage);
} }
else { else {
status = listeners.put(listener, handbackMessage); listeners.put(listener, handbackMessage);
} }
return status;
} }
public Object removeCloseListener(ConnectionCloseListener listener) { public void removeCloseListener(ConnectionCloseListener listener) {
return listeners.remove(listener); listeners.remove(listener);
} }
/** /**
......
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