Jive Messenger 2.2.2 Javadoc

org.jivesoftware.messenger.net
Class SocketReader

java.lang.Object
  extended by org.jivesoftware.messenger.net.SocketReader
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
ClientSocketReader, ComponentSocketReader, ServerSocketReader

public abstract class SocketReader
extends Object
implements Runnable

A SocketReader creates the appropriate Session based on the defined namespace in the stream element and will then keep reading and routing the received packets.

Author:
Gaston Dombiak

Field Summary
protected  SocketConnection connection
           
protected  boolean open
           
protected  String serverName
           
protected  Session session
           
 
Constructor Summary
SocketReader(PacketRouter router, String serverName, Socket socket, SocketConnection connection)
          Creates a dedicated reader for a socket.
 
Method Summary
protected  void processIQ(IQ packet)
          Process the received IQ packet.
protected  void processMessage(Message packet)
          Process the received Message packet.
protected  void processPresence(Presence packet)
          Process the received Presence packet.
 void run()
          A dedicated thread loop for reading the stream and sending incoming packets to the appropriate router.
protected  void shutdown()
          Notification message indicating that the SocketReader is shutting down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected Session session

connection

protected SocketConnection connection

serverName

protected String serverName

open

protected boolean open
Constructor Detail

SocketReader

public SocketReader(PacketRouter router,
                    String serverName,
                    Socket socket,
                    SocketConnection connection)
Creates a dedicated reader for a socket.

Parameters:
router - the router for sending packets that were read.
serverName - the name of the server this socket is working for.
socket - the socket to read from.
connection - the connection being read.
Method Detail

run

public void run()
A dedicated thread loop for reading the stream and sending incoming packets to the appropriate router.

Specified by:
run in interface Runnable

processIQ

protected void processIQ(IQ packet)
                  throws UnauthorizedException
Process the received IQ packet. Registered PacketInterceptor will be invoked before and after the packet was routed.

Subclasses may redefine this method for different reasons such as modifying the sender of the packet to avoid spoofing, rejecting the packet or even process the packet in another thread.

Parameters:
packet - the received packet.
Throws:
UnauthorizedException

processPresence

protected void processPresence(Presence packet)
                        throws UnauthorizedException
Process the received Presence packet. Registered PacketInterceptor will be invoked before and after the packet was routed.

Subclasses may redefine this method for different reasons such as modifying the sender of the packet to avoid spoofing, rejecting the packet or even process the packet in another thread.

Parameters:
packet - the received packet.
Throws:
UnauthorizedException

processMessage

protected void processMessage(Message packet)
                       throws UnauthorizedException
Process the received Message packet. Registered PacketInterceptor will be invoked before and after the packet was routed.

Subclasses may redefine this method for different reasons such as modifying the sender of the packet to avoid spoofing, rejecting the packet or even process the packet in another thread.

Parameters:
packet - the received packet.
Throws:
UnauthorizedException

shutdown

protected void shutdown()
Notification message indicating that the SocketReader is shutting down. The thread will stop reading and processing new requests. Subclasses may want to redefine this message for releasing any resource they might need.


Jive Messenger 2.2.2 Javadoc

Copyright © 1999-2004 Jive Software.