Commit eab6196e authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Refactoring changes


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@596 b35dd754-fafc-0310-a699-88a17e54d16e
parent fe5c6144
......@@ -13,11 +13,11 @@ package org.jivesoftware.messenger;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.xmpp.packet.Packet;
import org.dom4j.io.XMLWriter;
import org.xmlpull.v1.XmlPullParserException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
/**
* <p>Represents a connection on the server.</p>
......@@ -62,7 +62,7 @@ public interface Connection {
* @return The XmlSerializer underlying this connection
* @throws UnauthorizedException If caller doesn't have permission to access this resource
*/
XMLStreamWriter getSerializer() throws UnauthorizedException;
XMLWriter getSerializer() throws UnauthorizedException;
/**
* Close this session including associated socket connection.
......@@ -128,7 +128,7 @@ public interface Connection {
*
* @param packet The packet to deliver.
* @throws UnauthorizedException If caller doesn't have permission to access this resource
* @throws XMLStreamException if there was a problem sending the packet
* @throws org.xmlpull.v1.XmlPullParserException if there was a problem sending the packet
*/
void deliver(Packet packet) throws UnauthorizedException, XMLStreamException;
void deliver(Packet packet) throws UnauthorizedException, XmlPullParserException;
}
......@@ -133,8 +133,7 @@ public class OfflineMessageStrategy extends BasicModule {
session.getConnection().deliver(response);
Message errorResponse = message.createCopy();
errorResponse.setError(new PacketError(PacketError.Condition.item_not_found,
PacketError.Type.continue_processing));
errorResponse.setError(new PacketError(PacketError.Type.continue_processing, PacketError.Condition.item_not_found));
session.getConnection().deliver(errorResponse);
}
catch (Exception e) {
......
......@@ -13,8 +13,7 @@ package org.jivesoftware.messenger;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.xmpp.packet.Packet;
import javax.xml.stream.XMLStreamException;
import org.xmlpull.v1.XmlPullParserException;
/**
* Delivers packets to locally connected streams. This is the opposite
......@@ -34,6 +33,5 @@ public interface PacketDeliverer {
* @param packet The packet to route
* @throws java.lang.NullPointerException If the packet is null or the packet could not be routed
*/
public void deliver(Packet packet) throws
UnauthorizedException, PacketException, XMLStreamException;
public void deliver(Packet packet) throws UnauthorizedException, PacketException, XmlPullParserException;
}
......@@ -25,7 +25,6 @@ import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.xml.stream.XMLStreamException;
import org.jivesoftware.messenger.audit.AuditStreamIDFactory;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.container.Container;
......@@ -41,6 +40,7 @@ import org.xmpp.packet.JID;
import org.xmpp.packet.Message;
import org.xmpp.packet.Packet;
import org.xmpp.packet.Presence;
import org.xmlpull.v1.XmlPullParserException;
/**
* Manages the sessions associated with an account. The information
......@@ -261,7 +261,7 @@ public class SessionManager implements ConnectionCloseListener {
*
* @param packet
*/
private void broadcast(Packet packet) throws UnauthorizedException, PacketException, XMLStreamException {
private void broadcast(Packet packet) throws UnauthorizedException, PacketException, XmlPullParserException {
Iterator entries = resources.values().iterator();
while (entries.hasNext()) {
Session session = (Session)entries.next();
......@@ -746,7 +746,7 @@ public class SessionManager implements ConnectionCloseListener {
*
* @param packet The packet to be broadcast
*/
public void broadcast(Packet packet) throws UnauthorizedException, PacketException, XMLStreamException {
public void broadcast(Packet packet) throws UnauthorizedException, PacketException, XmlPullParserException {
sessionLock.readLock().lock();
try {
Iterator values = sessions.values().iterator();
......@@ -776,7 +776,7 @@ public class SessionManager implements ConnectionCloseListener {
*
* @param packet The packet to be broadcast
*/
public void userBroadcast(String username, Packet packet) throws UnauthorizedException, PacketException, XMLStreamException {
public void userBroadcast(String username, Packet packet) throws UnauthorizedException, PacketException, XmlPullParserException {
sessionLock.readLock().lock();
try {
SessionMap sessionMap = (SessionMap)sessions.get(username);
......
......@@ -29,7 +29,6 @@ import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.xml.stream.XMLStreamException;
public class ConnectionManagerImpl extends BasicModule implements ConnectionManager {
......@@ -109,7 +108,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
public XMPPServer server;
public PacketFactory packetFactory;
public void addSocket(Socket sock, boolean isSecure) throws XMLStreamException {
public void addSocket(Socket sock, boolean isSecure) {
try {
// the order of these calls is critical (stupid huh?)
Connection conn = new SocketConnection(deliverer,
......@@ -118,7 +117,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
isSecure);
Session session = sessionManager.createSession(conn);
SocketReadThread reader = new SocketReadThread(router,
packetFactory, serverName, auditManager.getAuditor(),
serverName, auditManager.getAuditor(),
sock, session);
reader.setDaemon(true);
reader.start();
......
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