tigase.xmpp.impl

## Class Presence

- java.lang.Object
- - tigase.xmpp.XMPPProcessor
  - - tigase.xmpp.impl.Presence

- All Implemented Interfaces:
    Comparable<XMPPImplIfc>, XMPPImplIfc, XMPPProcessorIfc, XMPPStopListenerIfc

      public class Presence
      extends XMPPProcessor
      implements XMPPProcessorIfc, XMPPStopListenerIfc

  Describe class Presence here. Created: Wed Feb 22 07:30:03 2006
  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DIRECT_PRESENCE` `DIRECT_PRESENCE` is a key in temporary session data for the collection of JIDs where direct presence was sent.
    `static String` | `OFFLINE_BUD_SENT` Field description
    `static String` | `OFFLINE_RES_SENT` Field description
    `static String` | `OFFLINE_ROSTER_LAST_SEEN_PROP_KEY` Field description
    `static String` | `PRESENCE_ELEMENT_NAME` Field description
    `static String` | `PRESENCE_GLOBAL_FORWARD` Field description
    `protected RosterAbstract` | `roster_util` Field description
    `static String` | `SKIP_OFFLINE_PROP_KEY` Field description
    `static String` | `USERS_STATUS_CHANGES` Field description
    `protected static String` | `XMLNS` Field description

    - ### 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 and Description
    `Presence()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addDirectPresenceJID(tigase.xmpp.JID jid, XMPPResourceConnection session)` Method description
    `protected static void` | `broadcastDirectPresences(StanzaType t, XMPPResourceConnection session, Queue<Packet> results, tigase.xml.Element pres)` Method description
    `static void` | `broadcastOffline(XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract roster_util)` `sendPresenceBroadcast` method broadcasts given presence to all buddies from roster and to all users to which direct presence was sent.
    `void` | `broadcastProbe(XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings)` `sendPresenceBroadcast` method broadcasts given presence to all budies from roster and to all users to which direct presence was sent.
    `protected void` | `buddyOnline(XMPPResourceConnection session, tigase.xmpp.JID buddy, Queue<Packet> results, boolean online)` Method description
    `int` | `concurrentQueuesNo()` Method description
    `protected static void` | `forwardPresence(Queue<Packet> results, Packet packet, tigase.xmpp.JID from)` Method description
    `protected RosterAbstract` | `getRosterUtil()` Method description
    `void` | `getStatistics(StatisticsList list)` Method description
    `String` | `id()` Method description
    `void` | `init(Map<String,Object> settings)` Method description
    `void` | `process(Packet packet, XMPPResourceConnection session, NonAuthUserRepository repo, Queue<Packet> results, Map<String,Object> settings)` Method description
    `protected void` | `processError(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType presenceType)` Method description
    `protected void` | `processInInitial(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType presenceType)` Method description
    `protected void` | `processInProbe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType presenceType)` Method description
    `protected void` | `processInSubscribe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type)` Method description
    `protected void` | `processInSubscribed(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type)` Method description
    `protected void` | `processInUnsubscribe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type)` Method description
    `protected void` | `processInUnsubscribed(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type)` Method description
    `protected void` | `processOutInitial(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType type)` Method description
    `protected void` | `processOutSubscribe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type)` Method description
    `protected void` | `processOutSubscribed(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type)` Method description
    `static void` | `removeDirectPresenceJID(tigase.xmpp.JID jid, XMPPResourceConnection session)` Method description
    `void` | `resendPendingInRequests(XMPPResourceConnection session, Queue<Packet> results)` Method description
    `static void` | `sendPresence(StanzaType t, tigase.xmpp.BareJID from, tigase.xmpp.BareJID to, Queue<Packet> results, tigase.xml.Element pres)` Method description
    `static Packet` | `sendPresence(StanzaType t, tigase.xmpp.JID from, tigase.xmpp.JID to, Queue<Packet> results, tigase.xml.Element pres)` Method description
    `static void` | `sendPresenceBroadcast(StanzaType t, XMPPResourceConnection session, EnumSet<RosterAbstract.SubscriptionType> subscrs, Queue<Packet> results, tigase.xml.Element pres, Map<String,Object> settings, RosterAbstract roster_util)` `sendPresenceBroadcast` method broadcasts given presence to all buddies from roster and to all users to which direct presence was sent.
    `protected void` | `sendRosterOfflinePresence(XMPPResourceConnection session, Queue<Packet> results)` Method sends server generated presence unavailable for all buddies from the roster with a custom status message.
    `void` | `stopped(XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings)` `stopped` method is called when user disconnects or logs-out.
    `String[][]` | `supElementNamePaths()` Method description
    `String[]` | `supNamespaces()` Method description
    `protected static void` | `updateOfflineChange(XMPPResourceConnection session, Queue<Packet> results)` `updateOfflineChange` method broadcast off-line presence to all other user active resources.
    `static void` | `updatePresenceChange(Packet presence, XMPPResourceConnection session, Queue<Packet> results)` `updatePresenceChange` method is used to broadcast to all active resources presence stanza received from other users, like incoming availability presence, subscription presence and so on...
    `protected static void` | `updateResourcesAvailable(XMPPResourceConnection session, StanzaType type, Packet packet)`
    `static void` | `updateUserResources(tigase.xml.Element presence, XMPPResourceConnection session, Queue<Packet> results, boolean initial)` `updateUserResources` method is used to broadcast to all other resources presence stanza from one user resource.

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

      `canHandle, compareTo, concurrentThreadsPerQueue, getComponentInfo, getInstance, isSupporting, supDiscoFeatures, supElements, supStreamFeatures, supTypes, toString`

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

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

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

      `canHandle, concurrentThreadsPerQueue, getComponentInfo, isSupporting, supDiscoFeatures, supElements, supStreamFeatures, supTypes`

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

      `compareTo`

- - ### Field Detail

    - #### DIRECT_PRESENCE

          public static final String DIRECT_PRESENCE

      `DIRECT_PRESENCE` is a key in temporary session data for the collection of JIDs where direct presence was sent. To all these addresses unavailable presence must be sent when user disconnects.
      See Also:
        Constant Field Values

    - #### OFFLINE_BUD_SENT

          public static final String OFFLINE_BUD_SENT

      Field description
      See Also:
        Constant Field Values

    - #### OFFLINE_RES_SENT

          public static final String OFFLINE_RES_SENT

      Field description
      See Also:
        Constant Field Values

    - #### OFFLINE_ROSTER_LAST_SEEN_PROP_KEY

          public static final String OFFLINE_ROSTER_LAST_SEEN_PROP_KEY

      Field description
      See Also:
        Constant Field Values

    - #### PRESENCE_ELEMENT_NAME

          public static final String PRESENCE_ELEMENT_NAME

      Field description
      See Also:
        Constant Field Values

    - #### PRESENCE_GLOBAL_FORWARD

          public static final String PRESENCE_GLOBAL_FORWARD

      Field description
      See Also:
        Constant Field Values

    - #### SKIP_OFFLINE_PROP_KEY

          public static final String SKIP_OFFLINE_PROP_KEY

      Field description
      See Also:
        Constant Field Values

    - #### USERS_STATUS_CHANGES

          public static final String USERS_STATUS_CHANGES

      Field description
      See Also:
        Constant Field Values

    - #### XMLNS

          protected static final String XMLNS

      Field description
      See Also:
        Constant Field Values

    - #### roster_util

          protected RosterAbstract roster_util

      Field description

  - ### Constructor Detail

    - #### Presence

          public Presence()

  - ### Method Detail

    - #### addDirectPresenceJID

          public static void addDirectPresenceJID(tigase.xmpp.JID jid,
                                  XMPPResourceConnection session)

      Method description
      Parameters:
        `jid` -
        `session` -

    - #### broadcastOffline

          public static void broadcastOffline(XMPPResourceConnection session,
                              Queue<Packet> results,
                              Map<String,Object> settings,
                              RosterAbstract roster_util)
                                       throws NotAuthorizedException,
                                              TigaseDBException

      `sendPresenceBroadcast` method broadcasts given presence to all buddies from roster and to all users to which direct presence was sent.
      Parameters:
        `session` - a `XMPPResourceConnection` value
        `results` -
        `settings` -
        `roster_util` -
      Throws:
        `NotAuthorizedException` - if an error occurs
        `TigaseDBException`

    - #### removeDirectPresenceJID

          public static void removeDirectPresenceJID(tigase.xmpp.JID jid,
                                     XMPPResourceConnection session)

      Method description
      Parameters:
        `jid` -
        `session` -

    - #### sendPresence

          public static void sendPresence(StanzaType t,
                          tigase.xmpp.BareJID from,
                          tigase.xmpp.BareJID to,
                          Queue<Packet> results,
                          tigase.xml.Element pres)

      Method description
      Parameters:
        `t` -
        `from` -
        `to` -
        `results` -
        `pres` -

    - #### sendPresence

          public static Packet sendPresence(StanzaType t,
                            tigase.xmpp.JID from,
                            tigase.xmpp.JID to,
                            Queue<Packet> results,
                            tigase.xml.Element pres)

      Method description
      Parameters:
        `t` -
        `from` -
        `to` -
        `results` -
        `pres` -

    - #### sendPresenceBroadcast

          public static void sendPresenceBroadcast(StanzaType t,
                                   XMPPResourceConnection session,
                                   EnumSet<RosterAbstract.SubscriptionType> subscrs,
                                   Queue<Packet> results,
                                   tigase.xml.Element pres,
                                   Map<String,Object> settings,
                                   RosterAbstract roster_util)
                                            throws NotAuthorizedException,
                                                   TigaseDBException

      `sendPresenceBroadcast` method broadcasts given presence to all buddies from roster and to all users to which direct presence was sent.
      Parameters:
        `t` - a `StanzaType` value
        `session` - a `XMPPResourceConnection` value
        `subscrs` -
        `results` -
        `pres` - an `Element` value
        `settings` -
        `roster_util` -
      Throws:
        `NotAuthorizedException` - if an error occurs
        `TigaseDBException`

    - #### updatePresenceChange

          public static void updatePresenceChange(Packet presence,
                                  XMPPResourceConnection session,
                                  Queue<Packet> results)
                                           throws NotAuthorizedException

      `updatePresenceChange` method is used to broadcast to all active resources presence stanza received from other users, like incoming availability presence, subscription presence and so on... Initial presences are however sent only to those resources which already have sent initial presence.
      Parameters:
        `presence` - an `Element` presence received from other users, we have to change 'to' attribute to full resource JID.
        `session` - a `XMPPResourceConnection` value keeping connection session object.
        `results` -
      Throws:
        `NotAuthorizedException` - if an error occurs

    - #### getStatistics

          public void getStatistics(StatisticsList list)

      Method description
      Specified by:
        `getStatistics` in interface `XMPPImplIfc`
      Overrides:
        `getStatistics` in class `XMPPProcessor`
      Parameters:
        `list` -

    - #### updateUserResources

          public static void updateUserResources(tigase.xml.Element presence,
                                 XMPPResourceConnection session,
                                 Queue<Packet> results,
                                 boolean initial)
                                          throws NotAuthorizedException

      `updateUserResources` method is used to broadcast to all other resources presence stanza from one user resource. So if new resource connects this method updates presence information about new resource to old resources and about old resources to new resource.
      Parameters:
        `presence` - an `Element` presence received from other users, we have to change 'to' attribute to full resource JID.
        `session` - a `XMPPResourceConnection` value keeping connection session object.
        `results` -
        `initial` -
      Throws:
        `NotAuthorizedException` - if an error occurs

    - #### broadcastDirectPresences

          protected static void broadcastDirectPresences(StanzaType t,
                                      XMPPResourceConnection session,
                                      Queue<Packet> results,
                                      tigase.xml.Element pres)
                                                  throws NotAuthorizedException,
                                                         TigaseDBException

      Method description
      Parameters:
        `t` -
        `session` -
        `results` -
        `pres` -
      Throws:
        `NotAuthorizedException`
        `TigaseDBException`

    - #### forwardPresence

          protected static void forwardPresence(Queue<Packet> results,
                             Packet packet,
                             tigase.xmpp.JID from)

      Method description
      Parameters:
        `results` -
        `packet` -
        `from` -

    - #### updateOfflineChange

          protected static void updateOfflineChange(XMPPResourceConnection session,
                                 Queue<Packet> results)
                                             throws NotAuthorizedException

      `updateOfflineChange` method broadcast off-line presence to all other user active resources.
      Parameters:
        `session` - a `XMPPResourceConnection` value
        `results` -
      Throws:
        `NotAuthorizedException` - if an error occurs

    - #### updateResourcesAvailable

          protected static void updateResourcesAvailable(XMPPResourceConnection session,
                                      StanzaType type,
                                      Packet packet)

    - #### broadcastProbe

          public void broadcastProbe(XMPPResourceConnection session,
                            Queue<Packet> results,
                            Map<String,Object> settings)
                              throws NotAuthorizedException,
                                     TigaseDBException

      `sendPresenceBroadcast` method broadcasts given presence to all budies from roster and to all users to which direct presence was sent.
      Parameters:
        `session` - a `XMPPResourceConnection` value
        `results` -
        `settings` -
      Throws:
        `NotAuthorizedException` - if an error occurs
        `TigaseDBException`

    - #### concurrentQueuesNo

          public int concurrentQueuesNo()

      Method description
      Specified by:
        `concurrentQueuesNo` in interface `XMPPImplIfc`
      Overrides:
        `concurrentQueuesNo` in class `XMPPProcessor`
      Returns:
        an integer preferred number of processing threads for the plugin.

    - #### id

          public String id()

      Method description
      Specified by:
        `id` in interface `XMPPImplIfc`
      Returns:
        a `String` value

    - #### init

          public void init(Map<String,Object> settings)
                    throws TigaseDBException

      Method description
      Specified by:
        `init` in interface `XMPPImplIfc`
      Overrides:
        `init` in class `XMPPProcessor`
      Parameters:
        `settings` -
      Throws:
        `TigaseDBException`

    - #### process

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

      Method description
      Specified by:
        `process` in interface `XMPPProcessorIfc`
      Parameters:
        `packet` -
        `session` -
        `repo` -
        `results` -
        `settings` -
      Throws:
        `XMPPException`

    - #### resendPendingInRequests

          public void resendPendingInRequests(XMPPResourceConnection session,
                                     Queue<Packet> results)
                                       throws NotAuthorizedException,
                                              TigaseDBException

      Method description
      Parameters:
        `session` -
        `results` -
      Throws:
        `NotAuthorizedException`
        `TigaseDBException`

    - #### stopped

          public void stopped(XMPPResourceConnection session,
                     Queue<Packet> results,
                     Map<String,Object> settings)

      `stopped` method is called when user disconnects or logs-out.
      Specified by:
        `stopped` in interface `XMPPStopListenerIfc`
      Parameters:
        `session` - a `XMPPResourceConnection` value
        `results` -
        `settings` -

    - #### supElementNamePaths

          public String[][] supElementNamePaths()

      Method description
      Specified by:
        `supElementNamePaths` in interface `XMPPImplIfc`
      Overrides:
        `supElementNamePaths` in class `XMPPProcessor`
      Returns:
        a `String[][]` value is an array for element paths for which the plugin offers processing capabilities. Each path is in form of a String array in order to reduce parsing overhead.

    - #### supNamespaces

          public String[] supNamespaces()

      Method description
      Specified by:
        `supNamespaces` in interface `XMPPImplIfc`
      Overrides:
        `supNamespaces` in class `XMPPProcessor`
      Returns:
        a `String[]` value

    - #### getRosterUtil

          protected RosterAbstract getRosterUtil()

      Method description

    - #### processError

          protected void processError(Packet packet,
                          XMPPResourceConnection session,
                          Queue<Packet> results,
                          Map<String,Object> settings,
                          RosterAbstract.PresenceType presenceType)
                               throws NotAuthorizedException,
                                      TigaseDBException,
                                      NoConnectionIdException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `presenceType` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### processInInitial

          protected void processInInitial(Packet packet,
                              XMPPResourceConnection session,
                              Queue<Packet> results,
                              Map<String,Object> settings,
                              RosterAbstract.PresenceType presenceType)
                                   throws NoConnectionIdException,
                                          NotAuthorizedException,
                                          TigaseDBException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `presenceType` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### processInProbe

          protected void processInProbe(Packet packet,
                            XMPPResourceConnection session,
                            Queue<Packet> results,
                            Map<String,Object> settings,
                            RosterAbstract.PresenceType presenceType)
                                 throws NotAuthorizedException,
                                        TigaseDBException,
                                        PacketErrorTypeException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `presenceType` -
      Throws:
        `NotAuthorizedException`
        `PacketErrorTypeException`
        `TigaseDBException`

    - #### processInSubscribe

          protected void processInSubscribe(Packet packet,
                                XMPPResourceConnection session,
                                Queue<Packet> results,
                                Map<String,Object> settings,
                                RosterAbstract.PresenceType pres_type)
                                     throws NotAuthorizedException,
                                            TigaseDBException,
                                            NoConnectionIdException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `pres_type` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### processInSubscribed

          protected void processInSubscribed(Packet packet,
                                 XMPPResourceConnection session,
                                 Queue<Packet> results,
                                 Map<String,Object> settings,
                                 RosterAbstract.PresenceType pres_type)
                                      throws NotAuthorizedException,
                                             TigaseDBException,
                                             NoConnectionIdException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `pres_type` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### processInUnsubscribe

          protected void processInUnsubscribe(Packet packet,
                                  XMPPResourceConnection session,
                                  Queue<Packet> results,
                                  Map<String,Object> settings,
                                  RosterAbstract.PresenceType pres_type)
                                       throws NotAuthorizedException,
                                              TigaseDBException,
                                              NoConnectionIdException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `pres_type` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### processInUnsubscribed

          protected void processInUnsubscribed(Packet packet,
                                   XMPPResourceConnection session,
                                   Queue<Packet> results,
                                   Map<String,Object> settings,
                                   RosterAbstract.PresenceType pres_type)
                                        throws NotAuthorizedException,
                                               TigaseDBException,
                                               NoConnectionIdException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `pres_type` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### sendRosterOfflinePresence

          protected void sendRosterOfflinePresence(XMPPResourceConnection session,
                                       Queue<Packet> results)
                                            throws NotAuthorizedException,
                                                   TigaseDBException,
                                                   NoConnectionIdException

      Method sends server generated presence unavailable for all buddies from the roster with a custom status message.
      Parameters:
        `session` -
        `results` -
      Throws:
        `TigaseDBException`
        `NotAuthorizedException`
        `NoConnectionIdException`

    - #### processOutInitial

          protected void processOutInitial(Packet packet,
                               XMPPResourceConnection session,
                               Queue<Packet> results,
                               Map<String,Object> settings,
                               RosterAbstract.PresenceType type)
                                    throws NotAuthorizedException,
                                           TigaseDBException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `type` -
      Throws:
        `NotAuthorizedException`
        `TigaseDBException`

    - #### processOutSubscribe

          protected void processOutSubscribe(Packet packet,
                                 XMPPResourceConnection session,
                                 Queue<Packet> results,
                                 Map<String,Object> settings,
                                 RosterAbstract.PresenceType pres_type)
                                      throws NotAuthorizedException,
                                             TigaseDBException,
                                             NoConnectionIdException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `pres_type` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### processOutSubscribed

          protected void processOutSubscribed(Packet packet,
                                  XMPPResourceConnection session,
                                  Queue<Packet> results,
                                  Map<String,Object> settings,
                                  RosterAbstract.PresenceType pres_type)
                                       throws NotAuthorizedException,
                                              TigaseDBException,
                                              NoConnectionIdException

      Method description
      Parameters:
        `packet` -
        `session` -
        `results` -
        `settings` -
        `pres_type` -
      Throws:
        `NoConnectionIdException`
        `NotAuthorizedException`
        `TigaseDBException`

    - #### buddyOnline

          protected void buddyOnline(XMPPResourceConnection session,
                         tigase.xmpp.JID buddy,
                         Queue<Packet> results,
                         boolean online)
                              throws NotAuthorizedException,
                                     TigaseDBException

      Method description
      Parameters:
        `session` -
        `buddy` -
        `results` -
        `online` -
      Throws:
        `NotAuthorizedException`
        `TigaseDBException`

Copyright © 2013 Tigase. All rights reserved.