tigase.jaxmpp.core.client.connector

## Class AbstractBoshConnector

- java.lang.Object
- - tigase.jaxmpp.core.client.connector.AbstractBoshConnector

- All Implemented Interfaces:
    Connector
  Direct Known Subclasses:
    BoshConnector, BoshConnector

      public abstract class AbstractBoshConnector
      extends Object
      implements Connector

  Abstract class for implementing BOSH connector.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `AbstractBoshConnector.BoshPacketReceivedHandler` Implemented by handlers of BoshPacketReceivedEvent.
    `static interface` | `AbstractBoshConnector.BoshPacketSendingHandler` Implemented by handlers of BoshPacketSendingEvent.

    - ### Nested classes/interfaces inherited from interface tigase.jaxmpp.core.client.Connector

      `Connector.ConnectedHandler, Connector.DisconnectedHandler, Connector.EncryptionEstablishedHandler, Connector.ErrorHandler, Connector.StanzaReceivedHandler, Connector.StanzaSendingHandler, Connector.State, Connector.StateChangedHandler, Connector.StreamRestartedHandler, Connector.StreamTerminatedHandler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BOSH_SERVICE_URL_KEY` Name of property that specify BOSH service URL. Type: String.
    `protected Context` | `context`
    `protected Logger` | `log`
    `protected Set<BoshRequest>` | `requests`
    `static String` | `RID_KEY` Type: Long.
    `static String` | `SID_KEY` Name of property that specify BOSH Session ID. Type: String.

    - ### Fields inherited from interface tigase.jaxmpp.core.client.Connector

      `COMPRESSED_KEY, CONNECTOR_STAGE_KEY, CONNECTOR_STAGE_TIMESTAMP_KEY, DISABLE_KEEPALIVE_KEY, ENCRYPTED_KEY, EXTERNAL_KEEPALIVE_KEY, PROXY_HOST, PROXY_PORT, PROXY_TYPE, RECONNECTING_KEY, SEE_OTHER_HOST_KEY, TRUST_MANAGERS_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBoshConnector(Context context)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addToRequests(BoshRequest worker)`
    `protected int` | `countActiveRequests()`
    `XmppSessionLogic` | `createSessionLogic(XmppModulesManager modulesManager, PacketWriter writer)` Returns instance of XmppSessionLogic to work with this connector.
    `protected void` | `fireOnConnected(SessionObject sessionObject)`
    `protected void` | `fireOnError(int responseCode, String responseData, Element response, Throwable caught, SessionObject sessionObject)`
    `protected void` | `fireOnStanzaReceived(int responseCode, String responseData, Element response, SessionObject sessionObject)`
    `protected void` | `fireOnTerminate(int responseCode, String responseData, Element response, SessionObject sessionObject)`
    `protected String` | `getSid()`
    `Connector.State` | `getState()` Returns current State of connector.
    `boolean` | `isCompressed()` Returns XML Stream compression state.
    `boolean` | `isSecure()` Returns connection security state.
    `void` | `keepalive()` Whitespace ping.
    `protected Long` | `nextRid()`
    `protected void` | `onError(BoshRequest request, int responseCode, String responseData, Element response, Throwable caught)`
    `protected void` | `onResponse(BoshRequest request, int responseCode, String responseData, Element response)`
    `protected void` | `onTerminate(BoshRequest request, int responseCode, String responseData, Element response)`
    `protected Element` | `prepareBody(byte[] payload)`
    `protected Element` | `prepareBody(Element payload)`
    `protected Element` | `prepareRetartBody()`
    `protected Element` | `prepareStartBody()`
    `protected Element` | `prepareTerminateBody(Element payload)`
    `protected abstract void` | `processSendData(Element element)`
    `protected void` | `removeFromRequests(BoshRequest ack)`
    `void` | `restartStream()` Sends new XML Stream header.
    `void` | `send(byte[] buffer)`
    `void` | `send(Element stanza)` Sends given XML Element to server.
    `protected void` | `setSid(String sid)`
    `protected void` | `setStage(Connector.State state)`
    `void` | `start()` Starts connector.
    `void` | `stop()` Stops connector and closes connections.
    `void` | `stop(boolean terminate)` Stops connector.
    `protected void` | `terminateAllWorkers()`

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

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

- - ### Field Detail

    - #### BOSH_SERVICE_URL_KEY

          public static final String BOSH_SERVICE_URL_KEY

      Name of property that specify BOSH service URL.
      Type: String.
      See Also:
        Constant Field Values

    - #### RID_KEY

          public static final String RID_KEY

      Type: Long.
      See Also:
        Constant Field Values

    - #### SID_KEY

          public static final String SID_KEY

      Name of property that specify BOSH Session ID.
      Type: String.
      See Also:
        Constant Field Values

    - #### context

          protected final Context context

    - #### log

          protected final Logger log

    - #### requests

          protected final Set<BoshRequest> requests

  - ### Constructor Detail

    - #### AbstractBoshConnector

          public AbstractBoshConnector(Context context)

  - ### Method Detail

    - #### addToRequests

          protected void addToRequests(BoshRequest worker)

    - #### countActiveRequests

          protected int countActiveRequests()

    - #### createSessionLogic

          public XmppSessionLogic createSessionLogic(XmppModulesManager modulesManager,
                                                     PacketWriter writer)

      Description copied from interface: `Connector`
      Returns instance of XmppSessionLogic to work with this connector.
      Specified by:
        `createSessionLogic` in interface `Connector`
      Parameters:
        `modulesManager` - module manager
        `writer` - writer
      Returns:
        XmppSessionLogic

    - #### fireOnConnected

          protected void fireOnConnected(SessionObject sessionObject)
                                  throws JaxmppException

      Throws:
        `JaxmppException`

    - #### fireOnError

          protected void fireOnError(int responseCode,
                                     String responseData,
                                     Element response,
                                     Throwable caught,
                                     SessionObject sessionObject)
                              throws JaxmppException

      Throws:
        `JaxmppException`

    - #### fireOnStanzaReceived

          protected void fireOnStanzaReceived(int responseCode,
                                              String responseData,
                                              Element response,
                                              SessionObject sessionObject)
                                       throws JaxmppException

      Throws:
        `JaxmppException`

    - #### fireOnTerminate

          protected void fireOnTerminate(int responseCode,
                                         String responseData,
                                         Element response,
                                         SessionObject sessionObject)
                                  throws JaxmppException

      Throws:
        `JaxmppException`

    - #### getSid

          protected String getSid()

    - #### setSid

          protected void setSid(String sid)

    - #### getState

          public Connector.State getState()

      Description copied from interface: `Connector`
      Returns current State of connector.
      Specified by:
        `getState` in interface `Connector`
      Returns:
        State of connector.

    - #### isCompressed

          public boolean isCompressed()

      Description copied from interface: `Connector`
      Returns XML Stream compression state.
      Specified by:
        `isCompressed` in interface `Connector`
      Returns:
        `true> if XML Stream is compressed.`

    - #### isSecure

          public boolean isSecure()

      Description copied from interface: `Connector`
      Returns connection security state.
      Specified by:
        `isSecure` in interface `Connector`
      Returns:
        `true> if connection is secured and encrypted.`

    - #### keepalive

          public void keepalive()
                         throws JaxmppException

      Description copied from interface: `Connector`
      Whitespace ping.
      Specified by:
        `keepalive` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### nextRid

          protected Long nextRid()

    - #### onError

          protected void onError(BoshRequest request,
                                 int responseCode,
                                 String responseData,
                                 Element response,
                                 Throwable caught)
                          throws JaxmppException

      Throws:
        `JaxmppException`

    - #### onResponse

          protected void onResponse(BoshRequest request,
                                    int responseCode,
                                    String responseData,
                                    Element response)
                             throws JaxmppException

      Throws:
        `JaxmppException`

    - #### onTerminate

          protected void onTerminate(BoshRequest request,
                                     int responseCode,
                                     String responseData,
                                     Element response)
                              throws JaxmppException

      Throws:
        `JaxmppException`

    - #### prepareBody

          protected Element prepareBody(byte[] payload)
                                 throws XMLException

      Throws:
        `XMLException`

    - #### prepareBody

          protected Element prepareBody(Element payload)
                                 throws XMLException

      Throws:
        `XMLException`

    - #### prepareRetartBody

          protected Element prepareRetartBody()
                                       throws XMLException

      Throws:
        `XMLException`

    - #### prepareStartBody

          protected Element prepareStartBody()
                                      throws XMLException

      Throws:
        `XMLException`

    - #### prepareTerminateBody

          protected Element prepareTerminateBody(Element payload)
                                          throws XMLException

      Throws:
        `XMLException`

    - #### processSendData

          protected abstract void processSendData(Element element)
                                           throws JaxmppException

      Throws:
        `JaxmppException`

    - #### removeFromRequests

          protected void removeFromRequests(BoshRequest ack)

    - #### restartStream

          public void restartStream()
                             throws JaxmppException

      Description copied from interface: `Connector`
      Sends new XML Stream header.
      Specified by:
        `restartStream` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### send

          public void send(byte[] buffer)
                    throws JaxmppException

      Throws:
        `JaxmppException`

    - #### send

          public void send(Element stanza)
                    throws JaxmppException

      Description copied from interface: `Connector`
      Sends given XML Element to server.
      Specified by:
        `send` in interface `Connector`
      Parameters:
        `stanza` - XML element to send.
      Throws:
        `JaxmppException`

    - #### setStage

          protected void setStage(Connector.State state)
                           throws JaxmppException

      Throws:
        `JaxmppException`

    - #### start

          public void start()
                     throws JaxmppException

      Description copied from interface: `Connector`
      Starts connector. If connector is properly configured it will tries to establsh connection with server.
      Specified by:
        `start` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### stop

          public void stop()
                    throws JaxmppException

      Description copied from interface: `Connector`
      Stops connector and closes connections.
      Specified by:
        `stop` in interface `Connector`
      Throws:
        `JaxmppException`

    - #### stop

          public void stop(boolean terminate)
                    throws JaxmppException

      Description copied from interface: `Connector`
      Stops connector.
      Specified by:
        `stop` in interface `Connector`
      Parameters:
        `terminate` - if `true`then connection will be terminated immediatelly and connector will be stopped.``
      Throws:
        `JaxmppException`

    - #### terminateAllWorkers

          protected void terminateAllWorkers()

Copyright © 2006–2022 Tigase. All rights reserved.