ChannelHandler.java 903 Bytes
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision$
 * $Date$
 *
Matt Tucker's avatar
Matt Tucker committed
6
 * Copyright (C) 2004 Jive Software. All rights reserved.
Matt Tucker's avatar
Matt Tucker committed
7
 *
Matt Tucker's avatar
Matt Tucker committed
8 9
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
10 11 12 13
 */

package org.jivesoftware.messenger;

14
import org.xmpp.packet.Packet;
15
import org.jivesoftware.messenger.auth.UnauthorizedException;
Matt Tucker's avatar
Matt Tucker committed
16 17 18 19 20 21

/**
 * Interface to handle packets delivered by Channels.
 *
 * @author Matt Tucker
 */
22
public interface ChannelHandler<T extends Packet> {
Matt Tucker's avatar
Matt Tucker committed
23 24 25 26 27

    /**
     * Process an XMPP packet.
     *
     * @param packet a packet to process.
28
     * @throws UnauthorizedException if not allowed to process the packet.
Matt Tucker's avatar
Matt Tucker committed
29 30 31 32 33
     * @throws PacketException thrown if the packet is malformed (results in the sender's
     *      session being shutdown).
     */
    public abstract void process(T packet) throws UnauthorizedException, PacketException;
}