public class BMOfflineMessages
extends tigase.xmpp.XMPPProcessor
implements tigase.xmpp.XMPPPostprocessorIfc, tigase.xmpp.XMPPProcessorIfc
<presence>
.
Created: Mon Oct 16 13:28:53 2006Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
MESSAGE_EVENT_PATH
Field holds an array for element paths for which the plugin offers
message saving capabilities.
|
static java.lang.String[] |
MESSAGE_HEADER_PATH
Field holds an array for element paths for which the plugin offers
processing capabilities.
|
protected static java.lang.String |
XMLNS
Field holds default client namespace for stanzas.
|
Constructor and Description |
---|
BMOfflineMessages() |
Modifier and Type | Method and Description |
---|---|
int |
concurrentQueuesNo() |
protected tigase.db.MsgRepositoryIfc |
getMsgRepoImpl(tigase.db.NonAuthUserRepository repo,
tigase.xmpp.XMPPResourceConnection conn)
Method allows obtaining instance of
MsgRepositoryIfc interface
implementation. |
java.lang.String |
id() |
protected boolean |
loadOfflineMessages(tigase.server.Packet packet,
tigase.xmpp.XMPPResourceConnection conn)
Method determines whether offline messages should be loaded - the process
should be run only once per user session and only for available/null
presence with priority greater than 0.
|
void |
postProcess(tigase.server.Packet packet,
tigase.xmpp.XMPPResourceConnection conn,
tigase.db.NonAuthUserRepository repo,
java.util.Queue<tigase.server.Packet> queue,
java.util.Map<java.lang.String,java.lang.Object> settings)
OfflineMessages postprocessor simply calls
savePacketForOffLineUser method to store packet to offline
repository. |
void |
process(tigase.server.Packet packet,
tigase.xmpp.XMPPResourceConnection conn,
tigase.db.NonAuthUserRepository repo,
java.util.Queue<tigase.server.Packet> results,
java.util.Map<java.lang.String,java.lang.Object> settings)
OfflineMessages processor is triggered by <presence>
stanza. |
java.util.Queue<tigase.server.Packet> |
restorePacketForOffLineUser(tigase.xmpp.XMPPResourceConnection conn,
tigase.db.MsgRepositoryIfc repo)
Method restores all messages from repository for the JID of the current
session.
|
boolean |
savePacketForOffLineUser(tigase.server.Packet pac,
tigase.db.MsgRepositoryIfc repo)
Method stores messages to offline repository with the following rules
applied, i.e.
|
tigase.xml.Element[] |
supDiscoFeatures(tigase.xmpp.XMPPResourceConnection session) |
java.lang.String[][] |
supElementNamePaths() |
java.lang.String[] |
supNamespaces() |
canHandle, compareTo, concurrentThreadsPerQueue, getComponentInfo, getInstance, getStatistics, init, isSupporting, supElements, supStreamFeatures, supTypes, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected static final java.lang.String XMLNS
msgoffline
plugin it is jabber:clientpublic static final java.lang.String[] MESSAGE_EVENT_PATH
msgoffline
plugin it is
presence stanzapublic static final java.lang.String[] MESSAGE_HEADER_PATH
msgoffline
plugin it is
presence stanzapublic int concurrentQueuesNo()
concurrentQueuesNo
in interface tigase.xmpp.XMPPImplIfc
public java.lang.String id()
id
in interface tigase.xmpp.XMPPImplIfc
public void postProcess(tigase.server.Packet packet, tigase.xmpp.XMPPResourceConnection conn, tigase.db.NonAuthUserRepository repo, java.util.Queue<tigase.server.Packet> queue, java.util.Map<java.lang.String,java.lang.Object> settings)
savePacketForOffLineUser
method to store packet to offline
repository.
postProcess
in interface tigase.xmpp.XMPPPostprocessorIfc
conn
- queue
- public void process(tigase.server.Packet packet, tigase.xmpp.XMPPResourceConnection conn, tigase.db.NonAuthUserRepository repo, java.util.Queue<tigase.server.Packet> results, java.util.Map<java.lang.String,java.lang.Object> settings) throws tigase.xmpp.NotAuthorizedException
OfflineMessages
processor is triggered by <presence>
stanza. Upon receiving it plugin tries to load messages from repository
and, if the result is not empty, sends them to the user
process
in interface tigase.xmpp.XMPPProcessorIfc
conn
- tigase.xmpp.NotAuthorizedException
public java.util.Queue<tigase.server.Packet> restorePacketForOffLineUser(tigase.xmpp.XMPPResourceConnection conn, tigase.db.MsgRepositoryIfc repo) throws tigase.db.UserNotFoundException, tigase.xmpp.NotAuthorizedException
Packet
objects added to LinkedList
collection and, if possible, sorted
by timestamp.conn
- user session which keeps all the user session data and also
gives an access to the user's repository data.repo
- an implementation of MsgRepositoryIfc
interfaceQueue
of Packet
objects based on all stored
payloads for the JID of the current session.tigase.db.UserNotFoundException
tigase.xmpp.NotAuthorizedException
public boolean savePacketForOffLineUser(tigase.server.Packet pac, tigase.db.MsgRepositoryIfc repo) throws tigase.db.UserNotFoundException
<body>
, <event>
or <header>
child element and only messages of type normal, chat.
Processed messages are stamped with the delay
element and
appropriate timestamp.
pac
- a Packet
object containing packet that should be
verified and savedrepo
- a MsgRepositoryIfc
repository handler responsible for
storing messagestrue
if the packet was correctly saved to repository,
false
otherwise.tigase.db.UserNotFoundException
public tigase.xml.Element[] supDiscoFeatures(tigase.xmpp.XMPPResourceConnection session)
supDiscoFeatures
in interface tigase.xmpp.XMPPImplIfc
supDiscoFeatures
in class tigase.xmpp.XMPPProcessor
public java.lang.String[][] supElementNamePaths()
supElementNamePaths
in interface tigase.xmpp.XMPPImplIfc
supElementNamePaths
in class tigase.xmpp.XMPPProcessor
public java.lang.String[] supNamespaces()
supNamespaces
in interface tigase.xmpp.XMPPImplIfc
supNamespaces
in class tigase.xmpp.XMPPProcessor
protected tigase.db.MsgRepositoryIfc getMsgRepoImpl(tigase.db.NonAuthUserRepository repo, tigase.xmpp.XMPPResourceConnection conn)
MsgRepositoryIfc
interface
implementation.conn
- user session which keeps all the user session data and also
gives an access to the user's repository data.repo
- an implementation of MsgRepositoryIfc
interfaceMsgRepositoryIfc
interface implementation.protected boolean loadOfflineMessages(tigase.server.Packet packet, tigase.xmpp.XMPPResourceConnection conn)
packet
- a Packet
object containing packet that should be
verified and savedconn
- user session which keeps all the user session data and also
gives an access to the user's repository data.true
if the messages should be loaded, false
otherwise.Copyright © 2021. All Rights Reserved.