Package org.jivesoftware.openfire.pep
Class PEPServiceManager
- java.lang.Object
-
- org.jivesoftware.openfire.pep.PEPServiceManager
-
- All Implemented Interfaces:
EntityCapabilitiesListener
public class PEPServiceManager extends Object implements EntityCapabilitiesListener
Manages the creation, persistence and removal ofPEPService
instances.- Author:
- Guus der Kinderen, guus.der.kinderen@gmail.com
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
Log
-
Constructor Summary
Constructors Constructor Description PEPServiceManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PEPService
create(org.xmpp.packet.JID owner)
void
destroy()
void
entityCapabilitiesChanged(org.xmpp.packet.JID entity, EntityCapabilities updatedEntityCapabilities, Set<String> featuresAdded, Set<String> featuresRemoved, Set<String> identitiesAdded, Set<String> identitiesRemoved)
Invoked when a change was detected in the capabilities of a particular entity.Set<Node>
findSubscribedNodes(org.xmpp.packet.JID entity, String nodeId)
Returns all PEP nodes with a specific ID that the provided entity is a subscriber to.PEPService
getPEPService(PubSubService.UniqueIdentifier uniqueIdentifier)
Retrieves a PEP service -- attempting first from memory, then from the database.PEPService
getPEPService(PubSubService.UniqueIdentifier uniqueIdentifier, boolean autoCreate)
Retrieves a PEP service -- attempting first from memory, then from the database.PEPService
getPEPService(org.xmpp.packet.JID jid)
Retrieves a PEP service -- attempting first from memory, then from the database.PEPService
getPEPService(org.xmpp.packet.JID jid, boolean autoCreate)
Retrieves a PEP service -- attempting first from memory, then from the database.boolean
hasCachedService(org.xmpp.packet.JID owner)
void
initialize()
void
process(PEPService service, org.xmpp.packet.IQ iq)
void
remove(org.xmpp.packet.JID owner)
Deletes thePEPService
belonging to the specified owner.void
start()
void
start(PEPService pepService)
void
stop()
-
-
-
Method Detail
-
initialize
public void initialize()
-
destroy
public void destroy()
-
getPEPService
public PEPService getPEPService(PubSubService.UniqueIdentifier uniqueIdentifier)
Retrieves a PEP service -- attempting first from memory, then from the database. This method will automatically create a PEP service if one does not exist.- Parameters:
uniqueIdentifier
- the unique identifier of the PEP service.- Returns:
- the requested PEP service.
-
getPEPService
public PEPService getPEPService(PubSubService.UniqueIdentifier uniqueIdentifier, boolean autoCreate)
Retrieves a PEP service -- attempting first from memory, then from the database. This method can automatically create a PEP service if one does not exist.- Parameters:
uniqueIdentifier
- the unique identifier of the PEP service.autoCreate
- true if a PEP service that does not yet exist needs to be created.- Returns:
- the requested PEP service if found or null if not found.
-
getPEPService
public PEPService getPEPService(org.xmpp.packet.JID jid)
Retrieves a PEP service -- attempting first from memory, then from the database. This method will automatically create a PEP service if one does not exist.- Parameters:
jid
- the JID of the user that owns the PEP service.- Returns:
- the requested PEP service.
-
getPEPService
public PEPService getPEPService(org.xmpp.packet.JID jid, boolean autoCreate)
Retrieves a PEP service -- attempting first from memory, then from the database. This method can automatically create a PEP service if one does not exist.- Parameters:
jid
- the JID of the user that owns the PEP service.autoCreate
- true if a PEP service that does not yet exist needs to be created.- Returns:
- the requested PEP service if found or null if not found.
-
create
public PEPService create(org.xmpp.packet.JID owner)
-
remove
public void remove(org.xmpp.packet.JID owner)
Deletes thePEPService
belonging to the specified owner.- Parameters:
owner
- The JID of the owner of the service to be deleted.
-
start
public void start(PEPService pepService)
-
start
public void start()
-
stop
public void stop()
-
process
public void process(PEPService service, org.xmpp.packet.IQ iq)
-
hasCachedService
public boolean hasCachedService(org.xmpp.packet.JID owner)
-
entityCapabilitiesChanged
public void entityCapabilitiesChanged(@Nonnull org.xmpp.packet.JID entity, @Nonnull EntityCapabilities updatedEntityCapabilities, @Nonnull Set<String> featuresAdded, @Nonnull Set<String> featuresRemoved, @Nonnull Set<String> identitiesAdded, @Nonnull Set<String> identitiesRemoved)
Description copied from interface:EntityCapabilitiesListener
Invoked when a change was detected in the capabilities of a particular entity. Apart from supplying the full entity capabilities object, each invocation will also include a the 'delta' of each capability characteristic: the features and identities that are new, or are removed, in the new capabilities, as compared to the previous capabilities for the entity. When no previous capabilities were registered for this entity, all characteristics will be new.- Specified by:
entityCapabilitiesChanged
in interfaceEntityCapabilitiesListener
- Parameters:
entity
- The entity for which CAPS changed.updatedEntityCapabilities
- The updated capabilities.featuresAdded
- The features that are now part of the capabilities, but were not in the previous capabilities of this entity.featuresRemoved
- The features that are now no longer part of the capabilities, but were in the previous capabilities of this entity.identitiesAdded
- The identities that are now present in the capabilities, but were not in the previous capabilities of this entity.identitiesRemoved
- The identities that are no longer part of the capabilities, but were in the previous capabilities of this entity.
-
findSubscribedNodes
@Nonnull public Set<Node> findSubscribedNodes(@Nonnull org.xmpp.packet.JID entity, @Nonnull String nodeId)
Returns all PEP nodes with a specific ID that the provided entity is a subscriber to. This would typically return a similar node for many different services (eg: the 'user-tune' node of the PEP services of all of entity's contacts.- Parameters:
entity
- The entity address.nodeId
- The NodeID of the nodes to return- Returns:
- A collection of nodes (possibly empty).
-
-