public class PresenceSubscription extends PresenceAbstract
Modifier and Type | Field and Description |
---|---|
static String |
AUTO_AUTHORIZE_PROP_KEY
key allowing enabling automatic authorisation.
|
protected static String |
ID |
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 |
---|
PresenceSubscription() |
Modifier and Type | Method and Description |
---|---|
void |
init(Map<String,Object> settings)
Method
init is called just after the plugin has been loaded
into memory. |
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 |
processInSubscribe(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType pres_type)
Method is responsible for processing incoming subscription request (i.e. in
the receivers session manager).
|
protected void |
processInSubscribed(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType pres_type)
Method is responsible for processing incoming subscribed presence (i.e. in
the receivers session manager).
|
protected void |
processInUnsubscribe(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType pres_type)
Method is responsible for processing incoming unsubscribe presence (i.e. in
the receivers session manager).
|
protected void |
processInUnsubscribed(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType pres_type)
Method is responsible for processing incoming unsubscribed presence (i.e.
|
protected void |
processOutSubscribe(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType pres_type)
Method is responsible for processing outgoing subscribe and unsubscribe
presence (i.e. in the sender session manager).
|
protected void |
processOutSubscribed(Packet packet,
XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings,
RosterAbstract.PresenceType pres_type)
Method is responsible for processing outgoing subscribed and unsubscribed
presence (i.e. in the sender session manager).
|
Set<StanzaType> |
supTypes()
Method returns an array of all stanza types which the plugin is able
to handle.
|
broadcastProbe, concurrentQueuesNo, forwardPresence, getRosterUtil, initSettings, prepareProbe, requiresPresenceSending, sendPresence, sendPresence, updatePresenceChange, updateUserResources
id, supDiscoFeatures, supElementNamePaths, supNamespaces, supStreamFeatures
canHandle, compareTo, concurrentThreadsPerQueue, getComponentInfo, getInstance, getStatistics, isSupporting, supElements, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canHandle, concurrentThreadsPerQueue, getComponentInfo, getStatistics, id, isSupporting, supDiscoFeatures, supElementNamePaths, supElements, supNamespaces, supStreamFeatures
compareTo
public static final String AUTO_AUTHORIZE_PROP_KEY
protected static final String ID
public void init(Map<String,Object> settings) throws TigaseDBException
XMPPImplIfc
init
is called just after the plugin has been loaded
into memory. The idea behind this is to allow it to initialize or check the
database. This might be especially useful for plugins which want to have a
database access via non-standard stored procedures or need schema upgrade.init
in interface XMPPImplIfc
init
in class XMPPProcessor
settings
- is a Map with initial processor settings from the configuration
file.TigaseDBException
public 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
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
protected void processInSubscribe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException, PolicyViolationException
If the contact is already subscribed the an auto-reply with
type='subscribded' is sent, otherwise contact is added to the roster (if
it's missing/there is no current subscription), sets the subscription type
to PresenceType.in_subscribe
and subsequently broadcast presence
update to all connected resources.
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.pres_type
- specifies type of the presence.NoConnectionIdException
NotAuthorizedException
TigaseDBException
PolicyViolationException
protected void processInSubscribed(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException, PolicyViolationException
Contact is added to the roster (if it's missing/there is no current
subscription), sets the subscription type to
PresenceType.in_subscribed
and subsequently, if subscription has
changed,forwards the presence to user resource connection as well as
broadcast presence update to all connected resources.
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.pres_type
- specifies type of the presence.NoConnectionIdException
NotAuthorizedException
TigaseDBException
PolicyViolationException
protected void processInUnsubscribe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException, PolicyViolationException
First method performs update of subscription of the given contact and subsequently the request is forwarded to the client to make sure it says in synch with the server (in case there was actual change in subscription). Lastly a roster push is generated to all connected resources to update them with current state of the roster and items subscriptions.
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.pres_type
- specifies type of the presence.NoConnectionIdException
NotAuthorizedException
TigaseDBException
PolicyViolationException
protected void processInUnsubscribed(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException, PolicyViolationException
First method checks for the current subscription of the contact and if this
verifies performs subsequent actions such as forwarding presence to the
user connection to make sure it says in synch with the server, updates
contact subscription with PresenceType.in_unsubscribed
and in case
that there was a change in user subscription send out a roster push to all
connected resources to update them with current state of the roster and
items subscriptions.
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.pres_type
- specifies type of the presence.NoConnectionIdException
NotAuthorizedException
TigaseDBException
PolicyViolationException
protected void processOutSubscribe(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException, PolicyViolationException
Presence packet is forwarded to the destination with the JID stripped from the resource.
In case of PresenceType.out_subscribe
packet type contact is
added to the roster (in case it was missing), a subscription state is being
updated and, in case there was a change, a roster push is being sent to all
user resources.
In case of PresenceType.out_unsubscribe
method updates contact
subscription (and generates roster push if there was a change) and if the
resulting contact subscription is NONE then contact is removed from the
roster.
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.pres_type
- specifies type of the presence.NoConnectionIdException
NotAuthorizedException
TigaseDBException
PolicyViolationException
protected void processOutSubscribed(Packet packet, XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings, RosterAbstract.PresenceType pres_type) throws NotAuthorizedException, TigaseDBException, NoConnectionIdException, PolicyViolationException
Presence packet is forwarded to the destination with the JID stripped from the resource, a subscription state is being updated and, in case there was a change, a roster push is being sent to all user resources. Also, in case of presence type out_subscribed server send current presence to the user from each of the contact's available resources. For the presence type out_unsubscribed an unavailable presence is sent.
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.pres_type
- specifies type of the presence.NoConnectionIdException
NotAuthorizedException
TigaseDBException
PolicyViolationException
Copyright © 2017 "Tigase, Inc.". All rights reserved.