Class SocketReader

java.lang.Object
org.jivesoftware.openfire.net.SocketReader
All Implemented Interfaces:
Runnable

public abstract class SocketReader extends Object implements Runnable
Deprecated.
Old, pre NIO / MINA code. Should not be used as Netty offers better performance. Currently only in use for server dialback.
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

    Fields
    Modifier and Type
    Field
    Description
    Deprecated.
    Reference to the physical connection.
    protected boolean
    Deprecated.
    Indicates if sockets initially will be plain text (false), or ecnrypted (true).
    protected boolean
    Deprecated.
     
    protected String
    Deprecated.
    Server name for which we are attending clients.
    protected LocalSession
    Deprecated.
    Session associated with the socket reader.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SocketReader(PacketRouter router, RoutingTable routingTable, String serverName, Socket socket, SocketConnection connection, boolean useBlockingMode, boolean directTLS)
    Deprecated.
    Creates a dedicated reader for a socket.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Deprecated.
    Uses the XPP to grab the opening stream tag and create an active session object.
    Deprecated.
     
    protected void
    process(org.dom4j.Element doc)
    Deprecated.
     
    protected void
    processIQ(org.xmpp.packet.IQ packet)
    Deprecated.
    Process the received IQ packet.
    protected void
    processMessage(org.xmpp.packet.Message packet)
    Deprecated.
    Process the received Message packet.
    protected void
    processPresence(org.xmpp.packet.Presence packet)
    Deprecated.
    Process the received Presence packet.
    void
    run()
    Deprecated.
    A dedicated thread loop for reading the stream and sending incoming packets to the appropriate router.
    protected void
    Deprecated.
    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 Details

    • session

      protected LocalSession session
      Deprecated.
      Session associated with the socket reader.
    • connection

      protected SocketConnection connection
      Deprecated.
      Reference to the physical connection.
    • serverName

      protected String serverName
      Deprecated.
      Server name for which we are attending clients.
    • directTLS

      protected boolean directTLS
      Deprecated.
      Indicates if sockets initially will be plain text (false), or ecnrypted (true).
    • open

      protected boolean open
      Deprecated.
  • Constructor Details

    • SocketReader

      public SocketReader(PacketRouter router, RoutingTable routingTable, String serverName, Socket socket, SocketConnection connection, boolean useBlockingMode, boolean directTLS)
      Deprecated.
      Creates a dedicated reader for a socket.
      Parameters:
      router - the router for sending packets that were read.
      routingTable - the table that keeps routes to registered services.
      serverName - the name of the server this socket is working for.
      socket - the socket to read from.
      connection - the connection being read.
      useBlockingMode - true means that the server will use a thread per connection.
      directTLS - false means that the socket initially is a plaintext connection.
  • Method Details

    • run

      public void run()
      Deprecated.
      A dedicated thread loop for reading the stream and sending incoming packets to the appropriate router.
      Specified by:
      run in interface Runnable
    • process

      protected void process(org.dom4j.Element doc) throws Exception
      Deprecated.
      Throws:
      Exception
    • processIQ

      protected void processIQ(org.xmpp.packet.IQ packet) throws UnauthorizedException
      Deprecated.
      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 - if the connection required encryption but was not encrypted.
    • processPresence

      protected void processPresence(org.xmpp.packet.Presence packet) throws UnauthorizedException
      Deprecated.
      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 - if the connection required encryption but was not encrypted.
    • processMessage

      protected void processMessage(org.xmpp.packet.Message packet) throws UnauthorizedException
      Deprecated.
      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 - if the connection required encryption but was not encryption.
    • createSession

      protected void createSession() throws UnauthorizedException, org.xmlpull.v1.XmlPullParserException, IOException
      Deprecated.
      Uses the XPP to grab the opening stream tag and create an active session object. The session to create will depend on the sent namespace. In all cases, the method obtains the opening stream tag, checks for errors, and either creates a session or returns an error and kills the connection. If the connection remains open, the XPP will be set to be ready for the first packet. A call to next() should result in an START_TAG state with the first packet in the stream.
      Throws:
      UnauthorizedException - if the connection required encryption but was not encrypted.
      org.xmlpull.v1.XmlPullParserException - if there was an XML error while creating the session.
      IOException - if an IO error occurred while creating the session.
    • shutdown

      protected void shutdown()
      Deprecated.
      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.
    • getSession

      public LocalSession getSession()
      Deprecated.