|
Openfire 3.6.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.openfire.container.BasicModule org.jivesoftware.openfire.handler.PresenceUpdateHandler
public class PresenceUpdateHandler
Implements the presence protocol. Clients use this protocol to update presence and roster information.
The handler must properly detect the presence type, update the user's roster, and inform presence subscribers of the session's updated presence status. Presence serves many purposes in Jabber so this handler will likely be the most complex of all handlers in the server. There are four basic types of presence updates:
Field Summary | |
---|---|
static String |
PRESENCE_CACHE_NAME
|
Constructor Summary | |
---|---|
PresenceUpdateHandler()
|
Method Summary | |
---|---|
Presence |
createSubscribePresence(JID senderAddress,
JID targetJID,
boolean isSubscribe)
|
void |
directedPresenceSent(Presence update,
JID handlerJID,
String jid)
Notification method sent to this handler when a user has sent a directed presence to an entity. |
boolean |
hasDirectPresence(JID ownerJID,
JID recipientJID)
|
void |
initialize(XMPPServer server)
Initializes the basic module. |
void |
joinedCluster()
Notification event indicating that this JVM is now part of a cluster. |
void |
joinedCluster(byte[] nodeID)
Notification event indicating that another JVM is now part of a cluster. |
void |
leftCluster()
Notification event indicating that this JVM is no longer part of the cluster. |
void |
leftCluster(byte[] nodeID)
Notification event indicating that another JVM is no longer part of the cluster. |
void |
markedAsSeniorClusterMember()
Notification event indicating that this JVM is now the senior cluster member. |
void |
process(Packet packet)
Process an XMPP packet. |
void |
process(Presence presence)
Handle presence updates that affect roster subscriptions. |
void |
removedExpiredPresences()
Removes directed presences sent to entities that are no longer available. |
Methods inherited from class org.jivesoftware.openfire.container.BasicModule |
---|
destroy, getName, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PRESENCE_CACHE_NAME
Constructor Detail |
---|
public PresenceUpdateHandler()
Method Detail |
---|
public void process(Packet packet) throws UnauthorizedException, PacketException
ChannelHandler
process
in interface ChannelHandler
packet
- a packet to process.
UnauthorizedException
- if not allowed to process the packet.
PacketException
- thrown if the packet is malformed (results in the sender's
session being shutdown).public void process(Presence presence) throws PacketException
presence
- The presence presence to handle
PacketException
- if the packet is null or the packet could not be routed.public Presence createSubscribePresence(JID senderAddress, JID targetJID, boolean isSubscribe)
public void directedPresenceSent(Presence update, JID handlerJID, String jid)
update
- the directed Presence sent by the user to an entity.handlerJID
- the JID of the handler that will receive/handle/process the sent packet.jid
- the receipient specified in the packet to handle.public boolean hasDirectPresence(JID ownerJID, JID recipientJID)
public void removedExpiredPresences()
public void initialize(XMPPServer server)
BasicModule
Initializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
initialize
in interface Module
initialize
in class BasicModule
server
- the server hosting this module.public void joinedCluster()
ClusterEventListener
XMPPServer.getNodeID()
holds the new nodeID value.
When joining the cluster as the senior cluster member the ClusterEventListener.markedAsSeniorClusterMember()
event will be sent right after this event.
At this point the CacheFactory holds clustered caches. That means that modifications to the caches will be reflected in the cluster. The clustered caches were just obtained from the cluster and no local cached data was automatically moved.
joinedCluster
in interface ClusterEventListener
public void joinedCluster(byte[] nodeID)
ClusterEventListener
At this point the CacheFactory of the new node holds clustered caches. That means that modifications to the caches of this JVM will be reflected in the cluster and in particular in the new node.
joinedCluster
in interface ClusterEventListener
nodeID
- ID of the node that joined the cluster.public void leftCluster()
ClusterEventListener
Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were this JVM belonged was marked as "old" then all nodes of that island will get the left cluster event and joined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where this JVM was the senior cluster member and when the islands met again then this JVM stopped being the senior member.
At this point the CacheFactory holds local caches. That means that modifications to the caches will only affect this JVM.
leftCluster
in interface ClusterEventListener
public void leftCluster(byte[] nodeID)
ClusterEventListener
Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were the other JVM belonged was marked as "old" then all nodes of that island will get the left cluster event and joined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where the other JVM was the senior cluster member and when the islands met again then the other JVM stopped being the senior member.
At this point the CacheFactory of the leaving node holds local caches. That means that modifications to the caches of this JVM will not affect the leaving node but other cluster members.
leftCluster
in interface ClusterEventListener
nodeID
- ID of the node that is left the cluster.public void markedAsSeniorClusterMember()
ClusterEventListener
Moreover, in the case of a "split brain" scenario (ie. separated cluster islands) each
island will have its own senior cluster member. However, when the islands meet again there
could only be one senior cluster member so one of the senior cluster members will stop playing
that role. When that happens the JVM no longer playing that role will receive the
ClusterEventListener.leftCluster()
and ClusterEventListener.joinedCluster()
events.
markedAsSeniorClusterMember
in interface ClusterEventListener
|
Openfire 3.6.1 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |