tigase.xmpp

## Class XMPPIOService<RefObject>

- java.lang.Object
- - tigase.net.IOService<RefObject>
  - - tigase.xmpp.XMPPIOService<RefObject>

- Type Parameters:
    `RefObject` - is a reference object stored by this service. This is e reference to higher level data object keeping more information about the connection.
  All Implemented Interfaces:
    Callable<IOService<?>>, TLSEventHandler, IOListener
  Direct Known Subclasses:
    BoshIOService, ComponentIOService, S2SIOService, WebSocketXMPPIOService

      public class XMPPIOService<RefObject>
      extends IOService<RefObject>

  Describe class XMPPIOService here. Created: Tue Feb 7 07:15:02 2006
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ACK_NAME` Field description
    `static String` | `CROSS_DOMAIN_POLICY_FILE_PROP_KEY` Field description
    `static String` | `CROSS_DOMAIN_POLICY_FILE_PROP_VAL` Field description
    `static String` | `DOM_HANDLER` Key name of the system property for configuration protection from system overload and DOS attack.
    `static String` | `ID_ATT` Field description
    `protected SimpleParser` | `parser` Field description
    `protected XMPPIOProcessor[]` | `processors`
    `static String` | `REQ_NAME` Field description
    `static String` | `STREAM_CLOSING`
    `ReentrantLock` | `writeInProgress` Field description

    - ### Fields inherited from class tigase.net.IOService

      `cb, CERT_CHECK_RESULT, CERT_REQUIRED_DOMAIN, decoder, encoder, HOSTNAME_KEY, partialCharacterBytes, PORT_TYPE_PROP_KEY, SESSION_ID_KEY, SSL_PROTOCOLS_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMPPIOService()` Creates a new `XMPPIOService` instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPacketToSend(Packet packet)` Method `addPacketToSend` adds new data which will be processed during next run.
    `protected void` | `addReceivedPacket(Packet packet)` Method `addReceivedPacket` puts processing results to queue.
    `IOService<?>` | `call()`
    `boolean` | `checkBufferLimit(int bufferSize)`
    `boolean` | `checkData(char[] data)`
    `void` | `clearWaitingPackets()` Clears queue of packets waiting to send.
    `void` | `forceStop()` Method description
    `long` | `getLastXmppPacketReceiveTime()` This method returns the time when the last XMPP packet was received, it is used to help detect dead connections.
    `long` | `getPacketsReceived(boolean reset)` Method description
    `long` | `getPacketsSent(boolean reset)` Method description
    `Queue<Packet>` | `getReceivedPackets()` Method description
    `long` | `getTotalPacketsReceived()` Method description
    `long` | `getTotalPacketsSent()` Method description
    `String` | `getUserJid()` Method description
    `Map<String,Packet>` | `getWaitingForAct()` Method description
    `Queue<Packet>` | `getWaitingPackets()` Returns queue with packets waiting to send.
    `String` | `getXMLNS()` Method description
    `protected String` | `prepareStreamClose()`
    `protected void` | `processSocketData()` Method description
    `void` | `processWaitingPackets()` Method description
    `protected int` | `receivedPackets()` Method description
    `void` | `setAckMode(boolean white_char_ack, boolean xmpp_ack, boolean strict)` Method description
    `void` | `setElementLimits(int limit)`
    `void` | `setIOServiceListener(XMPPIOServiceListener servList)` Method description
    `void` | `setProcessors(XMPPIOProcessor[] processors)` Method description
    `void` | `setUserJid(String jid)` Method description
    `void` | `setXMLNS(String xmlns)` Method description
    `void` | `stop()` Describe `stop` method here.
    `String` | `toString()`
    `void` | `writeRawData(String data)` Method description
    `protected void` | `xmppStreamClosed()` Method description
    `void` | `xmppStreamOpen(String data)` Method description
    `protected void` | `xmppStreamOpened(Map<String,String> attribs)` Method description

    - ### Methods inherited from class tigase.net.IOService

      `accept, byteOrder, connectionType, debug, debug, getBuffOverflow, getBytesReceived, getBytesSent, getConnectionId, getDataReceiver, getLastTransferTime, getLocalAddress, getLocalCertificate, getLocalPort, getPeerCertificate, getReadCounters, getRefObject, getRemoteAddress, getSessionData, getSocketChannel, getSocketInputSize, getStatistics, getTlsUniqueId, getTotalBuffOverflow, getTotalBytesReceived, getTotalBytesSent, getUniqueId, getWriteCounters, getX509TrustManagers, handshakeCompleted, isConnected, isInputBufferEmpty, isSocketServiceReady, readBytes, readCompleted, readData, setBufferLimit, setConnectionId, setDataReceiver, setIOServiceListener, setRefObject, setSessionData, setSocketServiceReady, setX509TrustManagers, startSSL, startTLS, startZLib, waitingToRead, waitingToSend, waitingToSendSize, writeBytes, writeData`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### ACK_NAME

          public static final String ACK_NAME

      Field description
      See Also:
        Constant Field Values

    - #### CROSS_DOMAIN_POLICY_FILE_PROP_KEY

          public static final String CROSS_DOMAIN_POLICY_FILE_PROP_KEY

      Field description
      See Also:
        Constant Field Values

    - #### CROSS_DOMAIN_POLICY_FILE_PROP_VAL

          public static final String CROSS_DOMAIN_POLICY_FILE_PROP_VAL

      Field description
      See Also:
        Constant Field Values

    - #### DOM_HANDLER

          public static final String DOM_HANDLER

      Key name of the system property for configuration protection from system overload and DOS attack.
      See Also:
        Constant Field Values

    - #### ID_ATT

          public static final String ID_ATT

      Field description
      See Also:
        Constant Field Values

    - #### REQ_NAME

          public static final String REQ_NAME

      Field description
      See Also:
        Constant Field Values

    - #### STREAM_CLOSING

          public static final String STREAM_CLOSING

      See Also:
        Constant Field Values

    - #### parser

          protected SimpleParser parser

      Field description

    - #### processors

          protected XMPPIOProcessor[] processors

    - #### writeInProgress

          public ReentrantLock writeInProgress

      Field description

  - ### Constructor Detail

    - #### XMPPIOService

          public XMPPIOService()

      Creates a new `XMPPIOService` instance.

  - ### Method Detail

    - #### addPacketToSend

          public void addPacketToSend(Packet packet)

      Method `addPacketToSend` adds new data which will be processed during next run. Data are kept in proper order like in FIFO queue.
      Parameters:
        `packet` - a `Packet` value of data to process.

    - #### call

          public IOService<?> call()
                            throws IOException

      Specified by:
        `call` in interface `Callable<IOService<?>>`
      Overrides:
        `call` in class `IOService<RefObject>`
      Throws:
        `IOException`

    - #### checkBufferLimit

          public boolean checkBufferLimit(int bufferSize)

      Specified by:
        `checkBufferLimit` in interface `IOListener`
      Overrides:
        `checkBufferLimit` in class `IOService<RefObject>`

    - #### checkData

          public boolean checkData(char[] data)
                            throws IOException

      Parameters:
        `data` -
      Returns:
        a value of `boolean`
      Throws:
        `IOException`

    - #### clearWaitingPackets

          public void clearWaitingPackets()

      Clears queue of packets waiting to send. In case of connection close this packets may be sent to offline store but some processors may want stop this from happening - for that they may use this method

    - #### getWaitingPackets

          public Queue<Packet> getWaitingPackets()

      Returns queue with packets waiting to send. For use by ConnectionManager which may need to get undelivered packets
      Returns:

    - #### forceStop

          public void forceStop()

      Description copied from class: `IOService`
      Method description
      Overrides:
        `forceStop` in class `IOService<RefObject>`

    - #### processWaitingPackets

          public void processWaitingPackets()
                                     throws IOException

      Description copied from class: `IOService`
      Method description
      Specified by:
        `processWaitingPackets` in class `IOService<RefObject>`
      Throws:
        `IOException`

    - #### stop

          public void stop()

      Description copied from class: `IOService`
      Describe `stop` method here.
      Overrides:
        `stop` in class `IOService<RefObject>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `IOService<RefObject>`

    - #### writeRawData

          public void writeRawData(String data)
                            throws IOException

      Method description
      Parameters:
        `data` -
      Throws:
        `IOException`

    - #### xmppStreamOpen

          public void xmppStreamOpen(String data)

      Method description
      Parameters:
        `data` -

    - #### getPacketsReceived

          public long getPacketsReceived(boolean reset)

      Method description
      Parameters:
        `reset` -
      Returns:
        a value of `long`

    - #### getPacketsSent

          public long getPacketsSent(boolean reset)

      Method description
      Parameters:
        `reset` -
      Returns:
        a value of `long`

    - #### getReceivedPackets

          public Queue<Packet> getReceivedPackets()

      Method description
      Returns:
        a value of `Queue<Packet>`

    - #### getTotalPacketsReceived

          public long getTotalPacketsReceived()

      Method description
      Returns:
        a value of `long`

    - #### getTotalPacketsSent

          public long getTotalPacketsSent()

      Method description
      Returns:
        a value of `long`

    - #### getUserJid

          public String getUserJid()

      Method description
      Returns:
        a value of `String`

    - #### getWaitingForAct

          public Map<String,Packet> getWaitingForAct()

      Method description
      Returns:
        a value of `Map<String,Packet>`

    - #### getXMLNS

          public String getXMLNS()

      Method description
      Returns:
        a value of `String`

    - #### setAckMode

          public void setAckMode(boolean white_char_ack,
                                 boolean xmpp_ack,
                                 boolean strict)

      Method description
      Parameters:
        `white_char_ack` -
        `xmpp_ack` -
        `strict` -

    - #### setElementLimits

          public void setElementLimits(int limit)

      Parameters:
        `limit` -

    - #### setIOServiceListener

          public void setIOServiceListener(XMPPIOServiceListener servList)

      Method description
      Parameters:
        `servList` -

    - #### setProcessors

          public void setProcessors(XMPPIOProcessor[] processors)

      Method description
      Parameters:
        `processors` - is a `XMPPIOProcessor[]`

    - #### setUserJid

          public void setUserJid(String jid)

      Method description
      Parameters:
        `jid` -

    - #### setXMLNS

          public void setXMLNS(String xmlns)

      Method description
      Parameters:
        `xmlns` -

    - #### addReceivedPacket

          protected void addReceivedPacket(Packet packet)

      Method `addReceivedPacket` puts processing results to queue. The processing results are usually data (messages) which has been just received from socket.
      Parameters:
        `packet` - a `Packet` value of processing results.

    - #### prepareStreamClose

          protected String prepareStreamClose()

    - #### processSocketData

          protected void processSocketData()
                                    throws IOException

      Description copied from class: `IOService`
      Method description
      Specified by:
        `processSocketData` in class `IOService<RefObject>`
      Throws:
        `IOException`

    - #### receivedPackets

          protected int receivedPackets()

      Description copied from class: `IOService`
      Method description
      Specified by:
        `receivedPackets` in class `IOService<RefObject>`

    - #### xmppStreamClosed

          protected void xmppStreamClosed()

      Method description

    - #### xmppStreamOpened

          protected void xmppStreamOpened(Map<String,String> attribs)

      Method description
      Parameters:
        `attribs` -

    - #### getLastXmppPacketReceiveTime

          public long getLastXmppPacketReceiveTime()

      This method returns the time when the last XMPP packet was received, it is used to help detect dead connections.
      Returns:
        `long` number denoting time when the last XMPP packet was received.

Copyright © 2022 "Tigase, Inc.". All rights reserved.