Commit 3c4065d6 authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Refactoring changes


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@598 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4ca03095
......@@ -11,23 +11,28 @@
package org.jivesoftware.messenger.handler;
import org.jivesoftware.messenger.container.TrackInfo;
import org.jivesoftware.messenger.ChannelHandler;
import org.jivesoftware.messenger.IQHandlerInfo;
import org.jivesoftware.messenger.IQRouter;
import org.jivesoftware.messenger.PacketDeliverer;
import org.jivesoftware.messenger.PacketException;
import org.jivesoftware.messenger.Session;
import org.jivesoftware.messenger.SessionManager;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.container.BasicModule;
import org.jivesoftware.messenger.container.TrackInfo;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log;
import org.jivesoftware.messenger.*;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.xmlpull.v1.XmlPullParserException;
import org.xmpp.packet.IQ;
import org.xmpp.packet.Packet;
import org.xmpp.packet.PacketError;
import javax.xml.stream.XMLStreamException;
/**
* <p>Base class whose main responsibility is to handle IQ packets. Subclasses may only need to
* specify the IQHandlerInfo (i.e. name and namespace of the packets to handle) and actually handle
* the IQ packet.</p>
*
* <p/>
* Simplifies creation of simple TYPE_IQ message handlers.
*
* @author Gaston Dombiak
......@@ -52,7 +57,7 @@ public abstract class IQHandler extends BasicModule implements ChannelHandler {
}
public void process(Packet packet) throws UnauthorizedException, PacketException {
IQ iq = (IQ)packet;
IQ iq = (IQ) packet;
try {
iq = handleIQ(iq);
if (iq != null) {
......@@ -71,13 +76,8 @@ public abstract class IQHandler extends BasicModule implements ChannelHandler {
}
catch (Exception de) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), de);
try {
SessionManager.getInstance().getSession(iq.getFrom()).getConnection().close();
}
catch (SessionNotFoundException se) {
// do nothing
}
}
}
}
catch (Exception e) {
......@@ -92,13 +92,14 @@ public abstract class IQHandler extends BasicModule implements ChannelHandler {
* @return the response to send back.
* @throws UnauthorizedException If the user that sent the packet is not authorized to request
* the given operation.
* @throws XMLStreamException If there was trouble reading the stream.
* @throws org.xmlpull.v1.XmlPullParserException
* If there was trouble reading the stream.
*/
public abstract IQ handleIQ(IQ packet) throws UnauthorizedException, XMLStreamException;
public abstract IQ handleIQ(IQ packet) throws UnauthorizedException, XmlPullParserException;
/**
* <p>Obtain the handler information to help generically handle IQ packets.</p>
*
* <p/>
* <p>IQHandlers that aren't local server iq handlers (e.g. chatbots, transports, etc)
* return a null.</p>
*
......
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