Class EntityCapabilitiesManager
- java.lang.Object
-
- org.jivesoftware.openfire.container.BasicModule
-
- org.jivesoftware.openfire.entitycaps.EntityCapabilitiesManager
-
- All Implemented Interfaces:
Module,UserEventListener,org.xmpp.component.IQResultListener
public class EntityCapabilitiesManager extends BasicModule implements org.xmpp.component.IQResultListener, UserEventListener
Implements server side mechanics for XEP-0115: "Entity Capabilities" Version 1.4 In particular, EntityCapabilitiesManager is useful for processing "filtered-notifications" for use with Pubsub (XEP-0060) for contacts that may not want to receive notifications for all payload types. The server's role in managing Entity Capabilities is to cache previously encountered entity capabilities for XMPP clients supporting the same identities and features. If the server has not seen a particular combination of identities and features, a Discover Information query is sent to that client and its reply is cached for future use by clients sharing those same entity capabilities.- Author:
- Armando Jagucki
-
-
Field Summary
Fields Modifier and Type Field Description static StringOPENFIRE_IDENTIFIER_NODEA XEP-0115 described identifier for the Openfire server software, intended to be used as a value of 'node' attributes.
-
Constructor Summary
Constructors Constructor Description EntityCapabilitiesManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidanswerTimeout(String packetId)protected voidcheckObsolete(String verHash)Verifies if the provided 'ver' hash is used for any user.voiddestroy()Destroys the module.static StringgenerateVerHash(org.xmpp.packet.IQ packet, String algorithm)Generates a 'ver' hash attribute used in validation to help prevent poisoning of entity capabilities information.EntityCapabilitiesgetEntityCapabilities(org.xmpp.packet.JID jid)Returns the entity capabilities for a specific JID.static EntityCapabilitiesManagergetInstance()Deprecated.Replaced byXMPPServer.getEntityCapabilitiesManager()static StringgetLocalDomainVerHash()Returns the 'ver' hash for this server.voidinitialize(XMPPServer server)Initializes the basic module.voidprocess(org.xmpp.packet.Presence packet)voidreceivedAnswer(org.xmpp.packet.IQ packet)voiduserCreated(User user, Map<String,Object> params)A user was created.voiduserDeleting(User user, Map<String,Object> params)A user is being deleted.voiduserModified(User user, Map<String,Object> params)A user's name, email, or an extended property was changed.-
Methods inherited from class org.jivesoftware.openfire.container.BasicModule
getName, start, stop
-
-
-
-
Field Detail
-
OPENFIRE_IDENTIFIER_NODE
public static final String OPENFIRE_IDENTIFIER_NODE
A XEP-0115 described identifier for the Openfire server software, intended to be used as a value of 'node' attributes.- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(XMPPServer server)
Description copied from class:BasicModuleInitializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
- Specified by:
initializein interfaceModule- Overrides:
initializein classBasicModule- Parameters:
server- the server hosting this module.
-
destroy
public void destroy()
Description copied from class:BasicModuleDestroys the module.
Does nothing in the basic module.
- Specified by:
destroyin interfaceModule- Overrides:
destroyin classBasicModule
-
getInstance
@Deprecated public static EntityCapabilitiesManager getInstance()
Deprecated.Replaced byXMPPServer.getEntityCapabilitiesManager()Returns the unique instance of this class.- Returns:
- the unique instance of this class.
-
process
public void process(org.xmpp.packet.Presence packet)
-
generateVerHash
public static String generateVerHash(org.xmpp.packet.IQ packet, String algorithm)
Generates a 'ver' hash attribute used in validation to help prevent poisoning of entity capabilities information.- Parameters:
packet- IQ reply to the entity cap request.algorithm- The hashing algorithm to use (e.g. SHA-1)- Returns:
- the generated 'ver' hash
- See Also:
The value of the 'ver' attribute is generated according to the method outlined in XEP-0115.
-
answerTimeout
public void answerTimeout(String packetId)
- Specified by:
answerTimeoutin interfaceorg.xmpp.component.IQResultListener
-
receivedAnswer
public void receivedAnswer(org.xmpp.packet.IQ packet)
- Specified by:
receivedAnswerin interfaceorg.xmpp.component.IQResultListener
-
getEntityCapabilities
public EntityCapabilities getEntityCapabilities(org.xmpp.packet.JID jid)
Returns the entity capabilities for a specific JID. The specified JID should be a full JID that identified the entity's connection.- Parameters:
jid- the full JID of entity- Returns:
- the entity capabilities of jid, or null if these are unavailable.
-
userDeleting
public void userDeleting(User user, Map<String,Object> params)
Description copied from interface:UserEventListenerA user is being deleted.- Specified by:
userDeletingin interfaceUserEventListener- Parameters:
user- the user.params- event parameters.
-
checkObsolete
protected void checkObsolete(String verHash)
Verifies if the provided 'ver' hash is used for any user. If not, the cache entry containing the entity capabilities are removed from the cache.- Parameters:
verHash- an 'ver' hash (cannot be null).
-
userCreated
public void userCreated(User user, Map<String,Object> params)
Description copied from interface:UserEventListenerA user was created.- Specified by:
userCreatedin interfaceUserEventListener- Parameters:
user- the user.params- event parameters.
-
userModified
public void userModified(User user, Map<String,Object> params)
Description copied from interface:UserEventListenerA user's name, email, or an extended property was changed.- Specified by:
userModifiedin interfaceUserEventListener- Parameters:
user- the user.params- event parameters.
-
getLocalDomainVerHash
public static String getLocalDomainVerHash()
Returns the 'ver' hash for this server.- Returns:
- A 'ver' hash, or null if none could be generated.
-
-