Package tigase.xmpp.impl

## Class PresenceOffline

- java.lang.Object
- - tigase.xmpp.XMPPProcessor
  - - tigase.xmpp.impl.annotation.AnnotatedXMPPProcessor
    - - tigase.xmpp.impl.PresenceAbstract
      - - tigase.xmpp.impl.PresenceOffline

- All Implemented Interfaces:
    `java.lang.Comparable<XMPPImplIfc>`, `Initializable`, `UnregisterAware`, `XMPPImplIfc`, `XMPPProcessorConcurrencyAwareIfc`, `XMPPProcessorIfc`, `XMPPStopListenerIfc`

      @Bean(name="presence-offline",
            parent=SessionManager.class,
            active=false)
      public class PresenceOffline
      extends PresenceAbstract
      implements XMPPStopListenerIfc, Initializable, UnregisterAware

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `class` | `PresenceOffline.StartStopEvent` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `CACHE_SIZE_PROP_KEY` |
    `protected static java.lang.String` | `ID` |

    - ### Fields inherited from class tigase.xmpp.impl.PresenceAbstract

      `PRESENCE_ELEMENT_NAME, PRESENCE_PROBE_FULL_JID_KEY, probeFullJID, roster_util, SKIP_OFFLINE_PROP_KEY, SKIP_OFFLINE_SYS_PROP_KEY, skipOffline, USERS_STATUS_CHANGES, XMLNS`

    - ### Fields inherited from class tigase.xmpp.XMPPProcessor

      `ALL_NAMES, ALL_PATHS, cmpInfo`

    - ### Fields inherited from interface tigase.xmpp.XMPPImplIfc

      `CLIENT_XMLNS`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PresenceOffline()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `beforeUnregister()` | Method called before bean unregister.
    `void` | `initialize()` | Method will be called, when bean will be created, configured and ready to use.
    `protected boolean` | `isNotOnlySession​(XMPPResourceConnection session)` |
    `protected boolean` | `isSubscriptionValid​(BareJID owner, BareJID contact)` |
    `protected Element` | `loadPresenceFromRepo​(BareJID stanzaTo)` |
    `void` | `onEvent​(PresenceOffline.StartStopEvent event)` |
    `void` | `process​(Packet packet, XMPPResourceConnection session, NonAuthUserRepository repo, java.util.Queue<Packet> results, java.util.Map<java.lang.String,​java.lang.Object> settings)` |
    `void` | `setCacheSize​(int size)` |
    `void` | `stopped​(XMPPResourceConnection session, java.util.Queue<Packet> results, java.util.Map<java.lang.String,​java.lang.Object> settings)` | Performs additional processing upon closing user session (user either disconnects or logs-out).

    - ### Methods inherited from class tigase.xmpp.impl.PresenceAbstract

      `broadcastProbe, concurrentQueuesNo, forwardPresence, getProbeFullJID, getRosterUtil, isSkipOffline, isSkipOfflineSys, prepareProbe, requiresPresenceSending, sendPresence, sendPresence, setProbeFullJID, setSkipOffline, setSkipOfflineSys, updatePresenceChange, updateUserResources`

    - ### Methods inherited from class tigase.xmpp.impl.annotation.AnnotatedXMPPProcessor

      `id, supDiscoFeatures, supElementNamePaths, supNamespaces, supStreamFeatures, supTypes`

    - ### Methods inherited from class tigase.xmpp.XMPPProcessor

      `canHandle, compareTo, getComponentInfo, getInstance, getQueueSize, getStatistics, getThreadsNo, init, toString`

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

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

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

    - ### Methods inherited from interface tigase.xmpp.XMPPImplIfc

      `canHandle, concurrentQueuesNo, getComponentInfo, getStatistics, id, init, supDiscoFeatures, supElementNamePaths, supNamespaces, supStreamFeatures, supTypes`

- - ### Field Detail

    - #### CACHE_SIZE_PROP_KEY

          public static final java.lang.String CACHE_SIZE_PROP_KEY

      See Also:
        Constant Field Values

    - #### ID

          protected static final java.lang.String ID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PresenceOffline

          public PresenceOffline()

  - ### Method Detail

    - #### initialize

          public void initialize()

      Description copied from interface: `Initializable`
      Method will be called, when bean will be created, configured and ready to use.
      Specified by:
        `initialize` in interface `Initializable`

    - #### beforeUnregister

          public void beforeUnregister()

      Description copied from interface: `UnregisterAware`
      Method called before bean unregister.
      Specified by:
        `beforeUnregister` in interface `UnregisterAware`

    - #### setCacheSize

          public void setCacheSize​(int size)

    - #### onEvent

          @HandleEvent(filter=remote)
          public void onEvent​(PresenceOffline.StartStopEvent event)

    - #### process

          public void process​(Packet packet,
                              XMPPResourceConnection session,
                              NonAuthUserRepository repo,
                              java.util.Queue<Packet> results,
                              java.util.Map<java.lang.String,​java.lang.Object> settings)
                       throws XMPPException

      Specified by:
        `process` in interface `XMPPProcessorIfc`
      Parameters:
        `packet` - packet is which being processed. This parameter may never be null. Even though this is not immutable object it mustn't be altered. None of it's fields or attributes can be changed during processing.
        `session` - user session which keeps all the user session data and also gives an access to the user's repository data. It allows for storing information in a permanent storage or in memory only during the live of the online session. This parameter can be null if there is no online user session at the time of the packet processing.
        `repo` - this is a user data storage which is normally used when the user session (parameter above) is null. This is repository allows for a very restricted access only. It allows for storing some user private data (doesn't allow overwriting existing data) like messages for offline users and it also allows for reading user public data like VCard.
        `results` - this a collection with packets which have been generated as input packet processing results. Regardless a response to a user request is sent or the packet is forwarded to it's destination it is always required that a copy of the input packet is created and stored in the results queue.
        `settings` - this map keeps plugin specific settings loaded from the Tigase server configuration. In most cases it is unused, however if the plugin needs to access an external database that this is a way to pass database connection string to the plugin.
      Throws:
        `XMPPException`

    - #### stopped

          public void stopped​(XMPPResourceConnection session,
                              java.util.Queue<Packet> results,
                              java.util.Map<java.lang.String,​java.lang.Object> settings)

      Description copied from interface: `XMPPStopListenerIfc`
      Performs additional processing upon closing user session (user either disconnects or logs-out).
      Specified by:
        `stopped` in interface `XMPPStopListenerIfc`
      Parameters:
        `session` - user session which keeps all the user session data and also gives an access to the user's repository data. It allows for storing information in a permanent storage or in memory only during the live of the online session. This parameter can be null if there is no online user session at the time of the packet processing.
        `results` - this a collection with packets which have been generated as input packet processing results. Regardless a response to a user request is sent or the packet is forwarded to it's destination it is always required that a copy of the input packet is created and stored in the results queue.
        `settings` - this map keeps plugin specific settings loaded from the Tigase server configuration. In most cases it is unused, however if the plugin needs to access an external database that this is a way to pass database connection string to the plugin.

    - #### isNotOnlySession

          protected boolean isNotOnlySession​(XMPPResourceConnection session)

    - #### isSubscriptionValid

          protected boolean isSubscriptionValid​(BareJID owner,
                                                BareJID contact)

    - #### loadPresenceFromRepo

          protected Element loadPresenceFromRepo​(BareJID stanzaTo)