Package 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`, `C2SIOService`, `ComponentIOService`, `S2SIOService`, `WebSocketXMPPIOService`

public class XMPPIOService<RefObject> extends IOService<RefObject>
Describe class XMPPIOService here.
Created: Tue Feb 7 07:15:02 2006

Author:
  Artur Hefczyc

- ## Field Summary

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

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

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

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  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()`
  `Optional<JID>`
  `getAuthorisedUserJid()`
  `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)`
  `long`
  `getPacketsSent(boolean reset)`
  `Queue<Packet>`
  `getReceivedPackets()`
  `long`
  `getTotalPacketsReceived()`
  `long`
  `getTotalPacketsSent()`
  `String`
  `getUserJid()`
  Deprecated.
  `Map<String,Packet>`
  `getWaitingForAct()`
  `Queue<Packet>`
  `getWaitingPackets()`
  Returns queue with packets waiting to send.
  `String`
  `getXMLNS()`
  `protected boolean`
  `hasParsedElements()`
  `protected void`
  `moveParsedPacketsToReceived(boolean sendAck)`
  `protected String`
  `prepareStreamClose()`
  `protected void`
  `processSocketData()`
  `void`
  `processWaitingPackets()`
  `protected int`
  `receivedPackets()`
  `void`
  `setAckMode(boolean white_char_ack, boolean xmpp_ack, boolean strict)`
  `void`
  `setAuthorisedUserJid(JID authorisedUserJid)`
  `void`
  `setElementLimits(int limit)`
  `void`
  `setIOServiceListener(XMPPIOServiceListener servList)`
  `void`
  `setProcessors(XMPPIOProcessor[] processors)`
  `void`
  `setUserJid(String jid)`
  Deprecated.
  `void`
  `setXMLNS(String xmlns)`
  `protected boolean`
  `shouldCountPacket(Packet packet)`
  `void`
  `stop()`
  `String`
  `toString()`
  `void`
  `writeRawData(String data)`
  `protected void`
  `xmppStreamClosed()`
  `void`
  `xmppStreamOpen(String data)`
  `protected void`
  `xmppStreamOpened(Map<String,String> attribs)`

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

  `accept, accept, byteOrder, connectionType, debug, debug, getBuffOverflow, getBytesReceived, getBytesSent, getCertificateContainer, getConnectionId, getDataReceiver, getIO, getLastTransferTime, getLocalAddress, getLocalCertificate, getLocalPort, getPeerCertificate, getReadCounters, getRefObject, getRemoteAddress, getSessionData, getSocketChannel, getSocketInputSize, getStatistics, getTlsExporter, getTlsUniqueId, getTotalBuffOverflow, getTotalBytesReceived, getTotalBytesSent, getUniqueId, getWriteCounters, handleMalformedInput, handshakeCompleted, isConnected, isInputBufferEmpty, isSocketServiceReady, readBytes, readCompleted, readData, setBufferLimit, setCertificateContainer, setConnectionId, setDataReceiver, setIOServiceListener, setRefObject, setSessionData, setSocketServiceReady, setSslContextContainer, 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 Details

  - ### ACK_NAME

    public static final String ACK_NAME
    See Also:
      - Constant Field Values

  - ### CROSS_DOMAIN_POLICY_FILE_PROP_KEY

    public static final String CROSS_DOMAIN_POLICY_FILE_PROP_KEY
    See Also:
      - Constant Field Values

  - ### CROSS_DOMAIN_POLICY_FILE_PROP_VAL

    public static final String CROSS_DOMAIN_POLICY_FILE_PROP_VAL
    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
    See Also:
      - Constant Field Values

  - ### REQ_NAME

    public static final String REQ_NAME
    See Also:
      - Constant Field Values

  - ### STREAM_CLOSING

    public static final String STREAM_CLOSING
    See Also:
      - Constant Field Values

  - ### writeInProgress

    public ReentrantLock writeInProgress

  - ### parser

    protected SimpleParser parser

  - ### processors

    protected XMPPIOProcessor[] processors

  - ### serviceListener

    protected XMPPIOServiceListener serviceListener

- ## Constructor Details

  - ### XMPPIOService

    public XMPPIOService()
    Creates a new `XMPPIOService` instance.

- ## Method Details

  - ### 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<RefObject>`
    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
    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

  - ### forceStop

    public void forceStop()
    Overrides:
      `forceStop` in class `IOService<RefObject>`

  - ### processWaitingPackets

    public void processWaitingPackets() throws IOException
    Specified by:
      `processWaitingPackets` in class `IOService<RefObject>`
    Throws:
      `IOException`

  - ### stop

    public void stop()
    Overrides:
      `stop` in class `IOService<RefObject>`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `IOService<RefObject>`

  - ### writeRawData

    public void writeRawData(String data) throws IOException
    Throws:
      `IOException`

  - ### xmppStreamOpen

    public void xmppStreamOpen(String data)

  - ### getPacketsReceived

    public long getPacketsReceived(boolean reset)

  - ### getPacketsSent

    public long getPacketsSent(boolean reset)

  - ### getReceivedPackets

    public Queue<Packet> getReceivedPackets()

  - ### getTotalPacketsReceived

    public long getTotalPacketsReceived()

  - ### getTotalPacketsSent

    public long getTotalPacketsSent()

  - ### getAuthorisedUserJid

    public Optional<JID> getAuthorisedUserJid()

  - ### setAuthorisedUserJid

    public void setAuthorisedUserJid(JID authorisedUserJid)

  - ### getUserJid

    @Deprecated public String getUserJid()
    Deprecated.

  - ### setUserJid

    @Deprecated public void setUserJid(String jid)
    Deprecated.

  - ### getWaitingForAct

    public Map<String,Packet> getWaitingForAct()

  - ### getXMLNS

    public String getXMLNS()

  - ### setXMLNS

    public void setXMLNS(String xmlns)

  - ### setAckMode

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

  - ### setElementLimits

    public void setElementLimits(int limit)

  - ### setIOServiceListener

    public void setIOServiceListener(XMPPIOServiceListener servList)

  - ### setProcessors

    public void setProcessors(XMPPIOProcessor[] processors)

  - ### 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.

  - ### 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.

  - ### shouldCountPacket

    protected boolean shouldCountPacket(Packet packet)

  - ### prepareStreamClose

    protected String prepareStreamClose()

  - ### processSocketData

    protected void processSocketData() throws IOException
    Specified by:
      `processSocketData` in class `IOService<RefObject>`
    Throws:
      `IOException`

  - ### receivedPackets

    protected int receivedPackets()
    Specified by:
      `receivedPackets` in class `IOService<RefObject>`

  - ### xmppStreamClosed

    protected void xmppStreamClosed()

  - ### xmppStreamOpened

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

  - ### hasParsedElements

    protected boolean hasParsedElements()

  - ### moveParsedPacketsToReceived

    protected void moveParsedPacketsToReceived(boolean sendAck)