@Bean(name="presence-state", parent=SessionManager.class, active=true) public class PresenceState extends PresenceAbstract implements XMPPStopListenerIfc
Modifier and Type | Class and Description |
---|---|
static interface |
PresenceState.ExtendedPresenceProcessorIfc |
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 |
ENABLE_ROSTER_LAZY_LOADING_KEY |
static String |
EXTENDED_PRESENCE_PROCESSORS_KEY |
protected static int |
HIGH_PRIORITY_PRESENCES_NO |
protected static String |
ID |
static String |
OFFLINE_BUD_SENT |
static String |
OFFLINE_RES_SENT |
static String |
OFFLINE_ROSTER_LAST_SEEN_PROP_KEY |
static String |
PRESENCE_GLOBAL_FORWARD
key allowing setting global forwarding JID address.
|
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
ALL_NAMES, ALL_PATHS, cmpInfo
CLIENT_XMLNS
Constructor and Description |
---|
PresenceState() |
Modifier and Type | Method and Description |
---|---|
static void |
addDirectPresenceJID(JID jid,
XMPPResourceConnection session)
Add JID to collection of JIDs to which direct presence was sent.
|
protected static void |
broadcastDirectPresences(StanzaType t,
XMPPResourceConnection session,
Queue<Packet> results,
Element pres)
broadcastDirectPresences broadcast a direct Presence from provided pres Element object to
the collection of JIDs stored in temporary session data under key DIRECT_PRESENCE . |
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. |
protected void |
buddyOnline(XMPPResourceConnection session,
JID buddy,
Queue<Packet> results,
boolean online)
Method sends back presence to contact while it becomes online (i.e. during processing of incoming initial
presence of the contact/buddy)
|
void |
getStatistics(StatisticsList list)
The method allows to retrieve plugin own statistics if it generates any.
|
void |
process(Packet packet,
XMPPResourceConnection session,
NonAuthUserRepository repo,
Queue<Packet> results,
Map<String,Object> settings)
Performs processing of presence packets and calls different methods for particular RosterAbstract.PresenceType |
protected void |
processError(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType presenceType)
Process presence stanza of type Error.
|
protected void |
processInInitial(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType presenceType)
Method is responsible for processing incoming initial presence (i.e. in the receivers session manager).
|
protected void |
processInProbe(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType presenceType)
Method is responsible for processing incoming presence probe (i.e. in the receivers session manager).
|
protected void |
processOutInitial(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType type)
Method is responsible for processing outgoing initial presence (i.e. in the sender session manager).
|
void |
rebroadcastPresence(XMPPResourceConnection session,
Queue<Packet> results) |
static void |
removeDirectPresenceJID(JID jid,
XMPPResourceConnection session)
Remove JID from collection of JIDs to which direct presence was sent.
|
void |
resendPendingInRequests(XMPPResourceConnection session,
Queue<Packet> results)
Sends out all pending subscription request during user log-in.
|
static void |
sendPresenceBroadcast(StanzaType t,
XMPPResourceConnection session,
EnumSet<RosterAbstract.SubscriptionType> subscrs,
Queue<Packet> results,
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)
Performs additional processing upon closing user session (user either disconnects or logs-out).
|
Set<StanzaType> |
supTypes()
Method returns an array of all stanza types which the plugin is able to handle.
|
protected static void |
updateOfflineChange(XMPPResourceConnection session,
Queue<Packet> results)
updateOfflineChange method broadcast off-line presence to all other user active resources. |
broadcastProbe, concurrentQueuesNo, forwardPresence, getProbeFullJID, getRosterUtil, isSkipOffline, isSkipOfflineSys, prepareProbe, requiresPresenceSending, sendPresence, sendPresence, setProbeFullJID, setSkipOffline, setSkipOfflineSys, updatePresenceChange, updateUserResources
id, supDiscoFeatures, supElementNamePaths, supNamespaces, supStreamFeatures
canHandle, compareTo, concurrentThreadsPerQueue, getComponentInfo, getInstance, getQueueSize, getThreadsNo, init, isSupporting, supElements, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canHandle, concurrentQueuesNo, concurrentThreadsPerQueue, getComponentInfo, id, init, isSupporting, supDiscoFeatures, supElementNamePaths, supElements, supNamespaces, supStreamFeatures
compareTo
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.public static final String ENABLE_ROSTER_LAZY_LOADING_KEY
public static final String EXTENDED_PRESENCE_PROCESSORS_KEY
public static final String OFFLINE_BUD_SENT
public static final String OFFLINE_RES_SENT
public static final String OFFLINE_ROSTER_LAST_SEEN_PROP_KEY
public static final String PRESENCE_GLOBAL_FORWARD
protected static final String ID
protected static int HIGH_PRIORITY_PRESENCES_NO
public static void addDirectPresenceJID(JID jid, XMPPResourceConnection session)
jid
- to which direct presence was sent.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.protected static void broadcastDirectPresences(StanzaType t, XMPPResourceConnection session, Queue<Packet> results, Element pres) throws NotAuthorizedException, TigaseDBException
broadcastDirectPresences
broadcast a direct Presence from provided pres
Element
object to
the collection of JIDs stored in temporary session data under key DIRECT_PRESENCE
.t
- specifies type of the presence to be send.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.pres
- an Object of type Element
holding Presence stanza to be sent.NotAuthorizedException
TigaseDBException
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.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.settings
- this map keeps plugin specific settings loaded from the Tigase server configuration.roster_util
- instance of class implementing RosterAbstract
.NotAuthorizedException
- if an error occursTigaseDBException
public static void removeDirectPresenceJID(JID jid, XMPPResourceConnection session)
jid
- to which direct presence was sent.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.public static void sendPresenceBroadcast(StanzaType t, XMPPResourceConnection session, EnumSet<RosterAbstract.SubscriptionType> subscrs, Queue<Packet> results, 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. Before sending presence method calls requiresPresenceSending()
performing, if configured, both system and roster check to verify whether presence needs to be sent.t
- specifies type of the presence to be send.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.subscrs
- an EnumSet<SubscriptionType>
holding all RosterAbstract.SubscriptionType
to which a Presence
should be broadcast.pres
- an Object of type Element
holding Presence stanza to be sent.settings
- this map keeps plugin specific settings loaded from the Tigase server configuration.roster_util
- instance of class implementing RosterAbstract
.NotAuthorizedException
- if an error occursTigaseDBException
protected static void updateOfflineChange(XMPPResourceConnection session, Queue<Packet> results) throws NotAuthorizedException
updateOfflineChange
method broadcast off-line presence to all other user active resources.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.NotAuthorizedException
- if an error occurspublic Set<StanzaType> supTypes()
XMPPImplIfc
supTypes
in interface XMPPImplIfc
supTypes
in class AnnotatedXMPPProcessor
StanzaType[]
array of supported stanza types.public void process(Packet packet, XMPPResourceConnection session, NonAuthUserRepository repo, Queue<Packet> results, Map<String,Object> settings) throws XMPPException
RosterAbstract.PresenceType
process
in interface XMPPProcessorIfc
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.XMPPException
public void stopped(XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings)
XMPPStopListenerIfc
stopped
in interface XMPPStopListenerIfc
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.public void getStatistics(StatisticsList list)
XMPPImplIfc
getStatistics
in interface XMPPImplIfc
getStatistics
in class XMPPProcessor
list
- is a statistics collection to which plugins own metrics can be added.public void rebroadcastPresence(XMPPResourceConnection session, Queue<Packet> results) throws NotAuthorizedException, TigaseDBException
public void resendPendingInRequests(XMPPResourceConnection session, Queue<Packet> results) throws NotAuthorizedException, TigaseDBException
session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.NotAuthorizedException
TigaseDBException
protected void processError(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType presenceType) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException
packet
- packet is which being processed.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.settings
- this map keeps plugin specific settings loaded from the Tigase server configuration.presenceType
- specifies type of the presenceNoConnectionIdException
NotAuthorizedException
TigaseDBException
protected void processInInitial(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType presenceType) throws NoConnectionIdException, NotAuthorizedException, TigaseDBException
packet
- packet is which being processed.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.settings
- this map keeps plugin specific settings loaded from the Tigase server configuration.presenceType
- specifies type of the presence.NoConnectionIdException
NotAuthorizedException
TigaseDBException
protected void processInProbe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType presenceType) throws NotAuthorizedException, TigaseDBException, PacketErrorTypeException
packet
- packet is which being processed.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.settings
- this map keeps plugin specific settings loaded from the Tigase server configuration.presenceType
- specifies type of the presence.NotAuthorizedException
PacketErrorTypeException
TigaseDBException
protected void processOutInitial(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType type) throws NotAuthorizedException, TigaseDBException
packet
- packet is which being processed.session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.settings
- this map keeps plugin specific settings loaded from the Tigase server configuration.type
- specifies type of the presence.NotAuthorizedException
TigaseDBException
protected void buddyOnline(XMPPResourceConnection session, JID buddy, Queue<Packet> results, boolean online) throws NotAuthorizedException, TigaseDBException
session
- user session which keeps all the user session data and also gives an access to the user's
repository data.buddy
- JID
of a roster element for which an online state will be setresults
- this a collection with packets which have been generated as input packet processing results.online
- set whether given contact is online or offlineNotAuthorizedException
TigaseDBException
protected void sendRosterOfflinePresence(XMPPResourceConnection session, Queue<Packet> results) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException
session
- user session which keeps all the user session data and also gives an access to the user's
repository data.results
- this a collection with packets which have been generated as input packet processing results.TigaseDBException
NotAuthorizedException
NoConnectionIdException
Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.